-->
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.  [ 2 posts ] 
Author Message
 Post subject: queryexception could not resolve the property type: userId
PostPosted: Fri Apr 30, 2004 12:18 am 
Newbie

Joined: Thu Apr 29, 2004 7:15 am
Posts: 4
hi!

i got one exception like that

********************************************
net.sf.hibernate.QueryException: could not resolve property type: userId [SELECT

groupHBM FROM com.liferay.portal.ejb.UserHBM userHBM JOIN userHBM.groups AS groupHBM

WHERE userHBM.userId = ? AND userHBM.portalId = ? ORDER BY name ASC
]

Tables used as following
user_
fields
******
1)userId
2)portalId
3)password
4)firstname

group_
fields
*****
1) groupId
2) portalId

users_groups(Mapping table for user and group)
fields
*****
1) groupId
2)userId
3) portalId


This is mapping file for table TCPS_User_
*****************************************************************************
<class name="com.liferay.portal.ejb.UserHBM" table="TCPS_User_">
<composite-id name="primaryKey" class="com.liferay.portal.ejb.UserPK">
<key-property name="userId" type="java.lang.String"/>
<key-property name="portalId" type="java.lang.String"/>
</composite-id>
<!--<id name="userId" type="java.lang.String"> --><set name="groups" table="Users_Groups" lazy="true">

<key>
<column name="userId" />
<column name="portalId"/>
</key>
<!-- <key column="userId" /> -->

<many-to-many class="com.liferay.portal.ejb.GroupHBM" column="groupId" />
</set>
</class>
**************************************************************************************
This is mapping file for table TCPS_Group_
*************************************************************************************

<class name="com.liferay.portal.ejb.GroupHBM" table="TCPS_Group_">

<id name="groupId" type="java.lang.String">
<generator class="assigned" />
</id>
<key column="groupId" />

<set name="users" table="Users_Groups" lazy="true">
<key column="groupId" />
<many-to-many class="com.liferay.portal.ejb.UserHBM">
<column name="userId"/>
<column name="portalId"/>
</many-to-many>
<!-- <many-to-many class="com.liferay.portal.ejb.UserHBM" column="userId" /> -->
</set>
</class>

Here the commented lines as well as in italic with bold format in the mapping files are previously in the working condition.
The uncommented lines with boldare changed by us for composite key.

But the exceptiontion occur in the following line
Line 1: userHBM = (UserHBM)session.load(UserHBM.class, userPK);
// Before modification
// userHBM = (UserHBM)session.load(UserHBM.class, pk);

where userPk is UserPK type
pk is the String type
in the line one the excetion occur

previously we r having userId alone and passing into the session.load method. Now we r passing UserPK class into the session.load method

why that excetion occur what wrong put in my work
the exception is like that
"could not resolve protperty type:userId"
plz give ur response immedidetly.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 30, 2004 1:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
http://forum.hibernate.org/viewtopic.ph ... 48#2200448


Post your question exactly once.

Please pay much more attention to etiquette in future.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.