-->
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: could not resolve property type userId in the query excetion
PostPosted: Fri Apr 30, 2004 1:17 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: String pk1 = userPK.userId;
Line 2: String pk2 = userPK.portalId;
Line 3: Query q = session.createQuery(query.toString());
Line 4: q.setString(0, pk1);
Line 5: q.setString(1, pk2);
Line 6: Iterator itr = q.list().iterator();
// Before modification
// userHBM = (UserHBM)session.load(UserHBM.class, pk);

where userPk is UserPK type
pk is the String type
in the line6, 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:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Code:
SELECT groupHBM
FROM com.liferay.portal.ejb.UserHBM userHBM
    JOIN userHBM.groups AS groupHBM
WHERE userHBM.id.userId = ?
   AND userHBM.id.portalId = ?
ORDER BY name ASC


Quote:
plz give ur response immedidetly.


You seem to be confused about what kind of relationship we have here. Don't try to order other people around, or you will be banned from the forum without any further warning,


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.