-->
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: QuereyException can not resolve property type: userId
PostPosted: Thu Apr 29, 2004 9:05 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]
at

net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:235)
at net.sf.hibernate.hql.PathExpressionParser.end(PathExpressionParser.java:281)
at net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:366)
at net.sf.hibernate.hql.WhereParser.doToken(WhereParser.java:393)
at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:279)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:120)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:146)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:133)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:352)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:330)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1368)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1332)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:76)
at com.liferay.portal.ejb.UserUtil.getGroups(UserUtil.java:452)
at com.liferay.portal.ejb.UserManagerEJB.getGroups(UserManagerEJB.java:448)
at com.liferay.portal.ejb.UserManagerEJB.getAllLayouts(UserManagerEJB.java:402)
at

com.liferay.portal.ejb.UserManagerEJB_i298xj_EOImpl.getAllLayouts(UserManagerEJB_i298xj_EOIm

pl.java:2389)
at com.liferay.portal.ejb.UserManagerUtil.getAllLayouts(UserManagerUtil.java:102)
at com.liferay.portal.model.User.getAllLayouts(User.java:315)
at com.liferay.portal.c.a.InitAction.run(InitAction.java:89)
at com.liferay.portal.c.ServiceAction.run(ServiceAction.java:89)
at com.liferay.portal.c.MainServlet.service(MainServlet.java:511)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at

weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1

053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at

com.liferay.filters.compression.CompressionFilter.doFilter(CompressionFilter.java:94)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at

weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletCont

ext.java:6316)
at

weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at

weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)
at

weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

********************************************************
user table part in the portal-hbm.xml file
********************************************************
<!-- Suresh had changed here for "composite-key" task -->
<!-- Changes: Changed "id" element into "composid-id" element and define "userId and portalId" as composite primary key-->
<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>
<!-- Suresh had changed here for "composite-key" task -->
<!-- Changes: Comment previous existing "id" element-->
<!-- <id name="userId" type="java.lang.String">
<generator class="assigned" />
</id>
<property name="companyId" />

<property name="companyId" column="portalId" />-->
<set name="groups" table="Users_Groups" lazy="true">
<!-- Suresh had changed here for "composite-key" task-->
<!-- Changes:Changed the foreign key "userId" of "key" element
into composite primary key using same "key" with following changes
previous one is commented -->
<key>
<column name="userId"/>
<column name="portalId"/>
</key>
<!-- <key column="userId" /> -->
<!-- Suresh had changed here for "composite-key" task-->
<!-- Changes:Changed the foreign key "groupId" of "many-to-many"
element into composite primary key using same "many-to-many" with
following changes previous one is commented
<many-to-many class="com.liferay.portal.ejb.GroupHBM">
<column name="groupId"/>
<column name="portalId"/>
</many-to-many>-->
<many-to-many class="com.liferay.portal.ejb.GroupHBM" column="groupId" />
</set>
*********************************************************
commented part previous one(working perfectly)
now change into composite key
********************************************************
this is for group table in the mapping file(portal-hbm.xml)
********************************************************
<class name="com.liferay.portal.ejb.GroupHBM" table="TCPS_Group_">

<!-- Changes: Changed the groupId primary key into composite primary key
by using element "composite-id" -->
<!-- Suresh had changed here for "composite-key" task
<composite-id name="primaryKey" class="com.liferay.portal.ejb.GroupPK">
<key-property name="groupId"/>
<key-property name="portalId"/>
</composite-id>-->
<id name="groupId" type="java.lang.String">
<generator class="assigned" />
</id>
<property name="companyId" column="portalId" />
<property name="parentGroupId"/>
<property name="name"/>
<property name="layoutIds"/>
<property name="wikiNodeIds"/>
<!--<set name="roles" table="Groups_Roles" lazy="true">

<key column="groupId" />
<many-to-many class="com.liferay.portal.ejb.RoleHBM" column="roleId" />
</set>-->
<set name="users" table="Users_Groups" lazy="true">
<!-- Suresh had changed here for "composite-key" task-->
<!-- Changes:Changed the foreign key "groupId" of "key" element into
composite primary key using same "key" with following changes
previous one is commented
<key>
<column name="groupId"/>
<column name="portalId"/>
</key>-->
<key column="groupId" />
<!-- Suresh had changed here for "composite-key" task-->
<!-- Changes: Added one more column element for portalId -->
<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>
***********************************************************

GroupHBM class structure

public class GroupHBM {
protected GroupHBM() {
}
private String _groupId;
private String _companyId;
private String _parentGroupId;
private String _name;
private String _layoutIds;
private String _wikiNodeIds;
private Set _roles;
private Set _users;
}

UserHBM class structure is

public class UserHBM {
protected UserHBM() {
}
private String _userId;
private String _portalId;
private String _password;
private boolean _passwordEncrypted;
private Date _passwordExpirationDate;
private String _firstName;
private String _middleName;
private String _lastName;
_(some of the field i left for convineance not necessary for our problem)
}

when we tried to change primary key (commented part in the mapping file) into composite key( non commented part in the mapping file).

the above exception occur.

whether i don't give proper name for "userId" in the persistors class or in the mapping file(portal-hbm).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 30, 2004 1:12 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
userHBM.id.userId

_________________
Emmanuel


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.