-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate 3.1 migration
PostPosted: Tue Dec 20, 2005 3:16 pm 
Newbie

Joined: Mon Jun 06, 2005 8:53 am
Posts: 16
Hi,

I'm trying to upgrade to hibernate 3.1 ( I was using 3.0.5 version), but I'm getting a lot of erros on my named queries. It was working on the old version.

What's different in this new version for that?

Here is one of my named queries that I'm having trouble:

<query name="getUsersBySystemId">
<![CDATA[from User u
where u.userMemberships.id.systemId = :systemId
and u.notesEmail != null
order by u.notesEmail]]>
</query>


Here is my userMemberships mapping on the USER class:

...
<set name="userMemberships" lazy="true" table="USERMEMBERSHIP">
<key column="serialNum" />
<one-to-many class="UserMembership" />
</set>

Here is my USERMEMBERSHIP class:

<class name="UserMembership" table="USERMEMBERSHIP">

<composite-id name="id" class="UserMembership$Id">
<key-property name="systemId" column="SYSNUMBER"/>
<key-property name="serialNum" column="SERIALNUM" length="25"/>
</composite-id>

<property name="roles">
<column name="ROLES" length="250" />
<type name="com.ibm.autobahn.domain.type.StringToListType">
<param name="delimiter">;</param>
</type>
</property>

<many-to-one name="user" insert="false" update="false" not-null="true">
<column name="SERIALNUM"/>
</many-to-one>

<many-to-one name="system" insert="false" update="false" not-null="true">
<column name="SYSNUMBER"/>
</many-to-one>

</class>

And here is the error:

[12/20/05 19:03:00:766 GMT] 30a8ed0b SystemErr R [Autobahn] [org.hibernate.impl.SessionFactoryImpl] [2005-12-20 19:03:00,766] [ERROR][Severity 2] Error in named query: getUsersBySystemId
org.hibernate.QueryException: could not resolve property: systemId of: com.ibm.autobahn.domain.UserMembership [
from com.ibm.autobahn.domain.User u
where u.userMemberships.id.systemId = :systemId
and u.notesEmail != null
order by u.notesEmail
]
at org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(AbstractPropertyMapping.java:43)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:37)
at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1265)
at org.hibernate.persister.collection.AbstractCollectionPersister.toType(AbstractCollectionPersister.java:1255)
at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:278)
at org.hibernate.hql.ast.tree.FromElement.getPropertyType(FromElement.java:372)

Please help!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 20, 2005 3:35 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
This "u.userMemberships" has never been officially supported, use an explicit join.


Top
 Profile  
 
 Post subject: Hibernate 3.1 migration - Another query problem
PostPosted: Thu Dec 22, 2005 6:29 am 
Newbie

Joined: Mon Jun 06, 2005 8:53 am
Posts: 16
What about this named query? It was fine with version 3.05, but with the new 3.1 I get this error message:

[org.hibernate.impl.SessionFactoryImpl] [2005-12-21 10:30:49,766] [ERROR][Severity 2] Error in named query: findClientMenu
org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list (com.domain.ISDPage -> com.domain.ISDMenu) [
select new com.dto.ISDMenuDTO(m,ps.contentType,c.content)
from com.ibm.autobahn.domain.ISDMenu m
left join fetch m.isdPage p
left join fetch p.pageSectionList ps
left join fetch ps.content c
where (ps.orderNum=1 or ps.orderNum is null) and m.menuId>0
order by m.level1OrderNum, m.level2OrderNum, m.level3OrderNum, m.orderNum

If I remove the "fetch" it works. When I'm using the "new" in the select query can't use fetch?

Thanks,
Cris


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 22, 2005 8:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Do you understand what fetch means?


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

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.