-->
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: Mapping problem with EJB 3.0 Entity Beans
PostPosted: Thu Sep 07, 2006 3:53 am 
Beginner
Beginner

Joined: Sun Aug 13, 2006 8:40 am
Posts: 28
Hibernate version:
Shipped with jboss-4.0.4.GA

Mapping documents:
EJB3.0 Entity Beans

Code between sessionFactory.openSession() and session.close():
N/A

Full stack trace of any exception that occurs:
Code:
Caused by: org.hibernate.hql.ast.QuerySyntaxException: a.package.AnEntity is not mapped [select e.propA, e.propB, e.propC from a.package.AnEntity as e where e.id in (select e.prop.id from a.package.AnotherEntity as ae where ae.prop = :param)]
   at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158)
   at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
   at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
   at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:267)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3049)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2938)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
   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:227)
   at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
   at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
   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:71)
   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:1612)
   at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:76)
   ... 76 more


Name and version of the database you are using:
Hypersonic shipped with jboss

The generated SQL (show_sql=true):
N/A

Debug level Hibernate log excerpt:
N/A

I am using a mapped superclass which annotates the primary keys for the database. This is a generated value of java.lang.Long.

But I get this exception and I also get an exception when I try to use @OneToMany (mappedBY = "id") as id is part of the mapped superclass and not this entity. How do I solve this?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 08, 2006 6:05 am 
Beginner
Beginner

Joined: Sun Aug 13, 2006 8:40 am
Posts: 28
I have tried to avoid this problem by applying the mapped superclass with the abstract methods of the primary key (getId() & setId(...)) and threfore implementing the primary key in every entity. I still reveice the same error:
Code:
Reason: org.hibernate.AnnotationException: mappedBy reference an unknown property: a.package.AnEntity.id in a.package.AnotherEntity.id


The syntax in AnEntity:
Code:
    @Id
    @GeneratedValue
    private Long id = null;


The syntax in AnotherEntity:
Code:
    @Id
    @GeneratedValue
    private Long id = null;
    @IndexColumn(name = "AnEntityIndex")
    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "id")
    private List <AnEntity> entities = null;


What am I doing wrong?


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.