-->
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.  [ 5 posts ] 
Author Message
 Post subject: Problem in querying non entity element...Need your help
PostPosted: Tue Aug 14, 2007 2:57 am 
Newbie

Joined: Fri Jun 01, 2007 6:04 am
Posts: 4
Hibernate version:3.0

My Domain Class :
--------------------------

@Entity
class Definition {

private List<String> m_actions;
.....
.....

@CollectionOfElements(fetch = FetchType.EAGER)
@IndexColumn(name = "sortOrder")
@Cascade(value = { CascadeType.ALL })
@Column(length = 500)
public List<String> getActions() {
return m_actions;
}

public void setActions(List<String> actions) {
m_actions = actions;
}

}


I've created query like this...
-----------------------------------

select id, actions from Definition;

It throws exception says that action is not an entity

complete stact trace:
------------------------

org.hibernate.QueryException: not an entity [select o.id, o.actions from com.alcatel.axs.app.alarms.pluginapi.Definition o]
at org.hibernate.hql.ast.tree.FromElementType.renderIdentifierSelect(FromElementType.java:143)
at org.hibernate.hql.ast.tree.FromElement.renderIdentifierSelect(FromElement.java:172)
at org.hibernate.hql.ast.tree.SelectClause.renderNonScalarIdentifiers(SelectClause.java:409)
at org.hibernate.hql.ast.tree.SelectClause.renderNonScalarSelects(SelectClause.java:387)
at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:223)
at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:704)
at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:528)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:645)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at com.alcatel.axs.container.persistence.HibernateMObject.query(HibernateMObject.java:533)
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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:299)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy35.query(Unknown Source)
at com.alcatel.axs.app.alarms.impl.SearchCriteriaTest.testAlarmCategory(SearchCriteriaTest.java:92)
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 org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
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.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)



Can anyone help me out to solve this issue. Moreover my requirement is not to have separate Action class.

Thanks in Advance.

Senthil.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 14, 2007 3:26 am 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
Quote:
select id, actions from Definition


What are you trying to do with this query?? Why not just use "from Definition" which will load the definitions and the associated actions?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 14, 2007 4:33 am 
Newbie

Joined: Fri Jun 01, 2007 6:04 am
Posts: 4
select id, actions from Definition

Actually this query will be generated from query framework..Based on the selection from UI, the select columns will be decided in the query.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 14, 2007 5:02 am 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
Try this:
select id, elements(actions) from Definition


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 14, 2007 5:50 am 
Newbie

Joined: Fri Jun 01, 2007 6:04 am
Posts: 4
Thanks mike!!!

It works...


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