-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate truncates names with underscore: MappingException:
PostPosted: Mon Nov 21, 2011 6:02 am 
Newbie

Joined: Tue Oct 09, 2007 12:07 pm
Posts: 6
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.