Hello,
currently I am discovering some strange behaviour in Hibernate:
Wenn we fire the following native SQL query via (SQLQuery)query.list():
Code:
select {d.*} from
mssqltest01_10000009 d
where CONTAINS(d.INDEXCONTENT, :text)
Hibernate throws the MappingException:
Quote:
DESC: org.hibernate.MappingException: Unknown entity: mssqltest01
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:693)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.getSQLLoadable(SQLQueryReturnProcessor.java:335)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.processRootReturn(SQLQueryReturnProcessor.java:376)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.processReturn(SQLQueryReturnProcessor.java:355)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.process(SQLQueryReturnProcessor.java:171)
at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:87)
at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:67)
at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:166)
at org.hibernate.impl.AbstractSessionImpl.getNativeSQLQueryPlan(AbstractSessionImpl.java:160)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
Note, this is a correct query that runs in MS SQL without any problem.
Our Mappings for the class mssqltest01_10000009 looks like:
Code:
<class dynamic-insert="false" dynamic-update="false"
entity-name=mssqltest01_10000009 schema="`dbo`"
select-before-update="false" table="`mssqltest01_10000009`">
<id column="`IDDOC`" name="IDDOC" type="string">
<generator class="native"/>
</id>
.....
<property column="`INDEXCONTENT`" name="INDEXCONTENT" type="string"/>
</class>
Do anyone have any idea, why Hibernate truncates the entity names before the underscore? Or what do I miss here?
We are working with a legacy system, therefore we are not allowed to change table/entity names.
Thank you for your help.
Larysa