-->
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.  [ 4 posts ] 
Author Message
 Post subject: The home of an entity
PostPosted: Fri Jan 20, 2006 8:33 am 
Beginner
Beginner

Joined: Thu Mar 18, 2004 8:11 am
Posts: 38
Location: Italy
Dears,

I'm having some problems in identifying the best approach to follow in order to create a .par archive with entitites and related "home" objects.

I was trying to follow the same pattern that the Hibernate Tools adopt when reverse-engineering a db structure using EJB3 annotations:

Code:
@Entity
@Table(...)
public class MyEntity implements Serializable {
...
}

@Stateless
public class MyEntityHome {
...
}


At deploy time, Entities are correctly detected and tables build (using the well-known "create-drop" hbm2ddl setting), but the "Homes" yield a "java.lang.ClassCastException: org.jboss.ejb3.stateless.StatelessContainer" and are not deployed.

Also, the ejb3 specs seems not specify anything about how to implement home methods in entities.

Please also note that I get the very same error when describing my entities through .hbm.xml file(s).

Is there any pattern to follow for home methods in entities? At least in the jboss 4.0.3SP1 I'm using.

Regards,

_________________
Giampaolo Tomassoni
Italy


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 20, 2006 9:04 am 
Newbie

Joined: Tue Jan 03, 2006 7:30 am
Posts: 18
Location: Budapest, Hungary
You don't have home interfaces in EJB3. Creation is done via the new operator and the constructors instead of create() and ejbCreate(), and finding entities is done through the persistence context, i.e. an EntityManager object.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 20, 2006 9:50 am 
Beginner
Beginner

Joined: Thu Mar 18, 2004 8:11 am
Posts: 38
Location: Italy
Yes, I read it in the specs.

But what is I want to supply some built-in finding methods? Can I only do it through a DAO, Facade or somehow business-related layer?

_________________
Giampaolo Tomassoni
Italy


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 20, 2006 6:15 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
it is considered bad practice to use the persistence API in you domain model.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.