We’ve updated recent from 6.2.1.Final to 7.0.0 when we have hibernate ddl-auto: validate (it was set to this before) an error occurs : hsearch_agent tenant_id does not exist during a select statement. Cannot paste the whole thing sadly.
@mbekhta I think this one is for you; I traced it back to [HSEARCH-4403] - Hibernate JIRA .
@Steven_Wood Do you by any chance use discriminator-based multi-tenancy?
hmm yeah, it would look like the ORM’s discriminator-based multi-tenancy is used, as that would be when Hibernate Search will try to add this additional column, if that’s so, I’d say just add a migration script to update the agent/event tables and add that column…
We might want to add something to the migration guide after all… We didn’t because discriminator-based multi-tenancy simply didn’t work in Hibernate Search before that change, so we thought if you hit this, you’d probably be facing a bug already, and this change would be the fix.
Many thanks for your replies, we do not use multi tenancy as far as I am aware (i’m gonna put a score of 95% confidence on that statement as I am not totally sure).
Ok, in that case I’m out of ideas… we’d need a reproducer
Could you try enabling debug logs for Hibernate Search and look for entries like:
(main) DEBUG OutboxPollingOutboxEventAdditionalJaxbMappingProducer:143 - HSEARCH850001: Generated entity mapping for outbox events used in the outbox-polling coordination strategy: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<entity-mappings xmlns="http://www.hibernate.org/xsd/orm/mapping">
<entity name="org.hibernate.search.mapper.orm.outboxpolling.event.impl.OutboxEvent" class="org.hibernate.search.mapper.orm.outboxpolling.event.impl.OutboxEvent" access="FIELD">
<table name="HSEARCH_OUTBOX_EVENT" catalog="" schema="">
<index name="entityIdHash" column-list="entityIdHash"/>
<index name="status" column-list="status"/>
<index name="processAfter" column-list="processAfter"/>
</table>
<attributes>
<id name="id" jdbc-type-code="1">
<uuid-generator style="random"/>
</id>
<basic name="entityName">
<column name="entityName" nullable="false" length="256"/>
</basic>
<basic name="entityId">
<column name="entityId" nullable="false" length="256"/>
</basic>
<basic name="entityIdHash">
<column name="entityIdHash" nullable="false"/>
</basic>
<basic name="payload">
<column name="payload" nullable="false" length="2147483647"/>
</basic>
<basic name="retries">
<column name="retries" nullable="false"/>
</basic>
<basic name="processAfter">
<column name="processAfter" nullable="false"/>
</basic>
<basic name="status">
<column name="status" nullable="false"/>
<enumerated>STRING</enumerated>
</basic>
</attributes>
</entity>
</entity-mappings>
to see if tenant id is included in this mapping. Alternatively, maybe you can try to run your app in debug and put a breakpoint here:
to see what mapping is generated.
And just to be clear, we were talking about usage of this Hibernate ORM’s annotation: @TenantId
But as Yoann is saying, if that doesn’t help figuring out what’s happening, we’d need some reproducer
Thank you for your help, I was not able to reproduce this either - and without any more information about how she got it, I don’t know what to say. Trying it myself on a clean env, I get the following error about a wrong column type for [state] in hsearch_agent found [int2 (Types#SMALLINT)] but expecting [varchar(255) Types#VARCHAR]
presume that can just be fixed with an additional migration script to change the column type.
Thanks for your help will report back if I find out how to reproduce it.