so i attempted the code, but i have run in to some problems
so i try to run this
Code:
.
.
.
Session sess = getCurrentSession();
List i = sess.createQuery("SELECT new LabelBean(ag.groupId,ag.groupName) " +
" FROM AudienceGroup ag JOIN ag.UsersSet user " +
"WHERE user.userId ='system'").list();
and everything seems fine apart from this error
Code:
[2006-09-28 11:56:05,396] DEBUG [main] ErrorCounter: throwQueryException() : no errors
[2006-09-28 11:56:05,521] INFO [Finalizer] DriverManagerConnectionProvider: cleaning up connection pool: jdbc:hsqldb:mem:Test
[2006-09-28 11:56:05,568] DEBUG [main] HqlSqlBaseWalker: query() << begin, level = 1
[2006-09-28 11:56:05,615] DEBUG [main] FromElement: FromClause{level=1} : data.pojos.AudienceGroup (ag) -> audiencegr0_
[2006-09-28 11:56:05,615] DEBUG [main] FromReferenceNode: Resolved : ag -> audiencegr0_.group_id
[2006-09-28 11:56:05,615] DEBUG [main] DotNode: getDataType() : UsersSet -> org.hibernate.type.SetType(data.pojos.AudienceGroup.UsersSet)
[2006-09-28 11:56:05,615] DEBUG [main] FromElementFactory: createEntityAssociation() : One to many - path = ag.UsersSet role = data.pojos.AudienceGroup.UsersSet associatedEntityName = elmo.data.pojos.User
[2006-09-28 11:56:05,615] DEBUG [main] FromElement: FromClause{level=1} : data.pojos.User (user) -> usersset1_
[2006-09-28 11:56:05,615] DEBUG [main] FromClause: addJoinByPathMap() : ag.UsersSet -> ELMO_Users usersset1_
[2006-09-28 11:56:05,615] DEBUG [main] DotNode: dereferenceCollection() : Created new FROM element for ag.UsersSet : ELMO_Users usersset1_
[2006-09-28 11:56:05,615] DEBUG [main] FromReferenceNode: Resolved : ag.UsersSet -> .
[2006-09-28 11:56:05,630] DEBUG [main] HqlSqlWalker: createFromJoinElement() : -- join tree --
\-[JOIN_FRAGMENT] FromElement: 'ELMO_Users usersset1_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=user,role=data.pojos.AudienceGroup.UsersSet,tableName=ELMO_Users,tableAlias=usersset1_,colums={audiencegr0_.group_id ,className=data.pojos.User}}
[2006-09-28 11:56:05,646] DEBUG [main] FromReferenceNode: Resolved : ag -> audiencegr0_.group_id
[2006-09-28 11:56:05,646] DEBUG [main] DotNode: getDataType() : groupId -> org.hibernate.type.IntegerType@52c6b4
[2006-09-28 11:56:05,646] DEBUG [main] FromReferenceNode: Resolved : ag.groupId -> audiencegr0_.group_id
[2006-09-28 11:56:05,646] DEBUG [main] FromReferenceNode: Resolved : ag -> audiencegr0_.group_id
[2006-09-28 11:56:05,646] DEBUG [main] DotNode: getDataType() : groupName -> org.hibernate.type.StringType@738d08
[2006-09-28 11:56:05,646] DEBUG [main] FromReferenceNode: Resolved : ag.groupName -> audiencegr0_.group_name
[2006-09-28 11:56:05,662] ERROR [main] PARSER: *** ERROR: Unable to locate class [LabelBean]
[cause=java.lang.ClassNotFoundException: LabelBean]
[2006-09-28 11:56:05,662] DEBUG [main] ErrorCounter: Unable to locate class [LabelBean]
[cause=java.lang.ClassNotFoundException: LabelBean]
Unable to locate class [LabelBean]
[cause=java.lang.ClassNotFoundException: LabelBean]
at org.hibernate.hql.ast.ConstructorNode.resolveConstructor(ConstructorNode.java:115)
at org.hibernate.hql.ast.ConstructorNode.prepare(ConstructorNode.java:86)
at org.hibernate.hql.ast.HqlSqlWalker.processConstructor(HqlSqlWalker.java:543)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:1598)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1467)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1041)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:380)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at web.dao.UserDAO.getUserGroup(UserDAO.java:51)
at web.dao.UserDAOTest.testGetUserGroup(UserDAOTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
i am stummped as to where i should be placeing the class ? do i need to define it somewhere for Hibernate to pick it up ?