[EJB 3.0] - Re: Problem with containment interacting with inheritance?
by knaveofhearts
I have gotten the original concept (i.e., Planet is a Geopolitical Unit, Country is a Geopolitical Unit, Planet contains collection of Countries) to work. Two things that caused me problems in coming up with a solution empirically:
- Having a subclass entity that is serializable of a base entity class that is not. Entities supposedly don't have to be serializable (Burke et al., Enterprise Java Beans 3.0, p. 52), but I have not tried going back and tried making them all non-serializable;
- Not having an empty constructor at each level; I do not remember reading that this as a requirement of entity POJOs in Burke et al., but it is certainly not in the index!!!
The code I wound up with does not look especially like my original posting, since I proceeded by getting one small piece working right, and then building on it incrementally, rather than trying to figure out what was wrong with what I had done originally.
K/H
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958323#3958323
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958323
19 years, 9 months
[EJB 3.0] - Re: Client access to Entity beans
by fguerzoni
It's not MVC pattern, but FACADE pattern.
You don't need an EM on client, because EM can't do anything for you on client for client-server applications.
EM performs transactionally CRUD operations on server.
You have two options:
1) passing detached object to client, let client work on them, and eventually reattach them to EM on server -> less code
2) converting entities (model) to dto object and viceversa -> more flexibility
At the moment I've chosed the second option because I can't download to client all the Hibernate classes required to manage detached entity.
In the second case try out Dozer, it's a mapping library that does all the bidirectional mapping between model and dto quite automagically.
If your application is a standalone application, without server connection, so you have the database directly on client, you must bootstrap an embedded container and follow the general ejb3 tutorial. There's a lot of sample that explain how to do that.
ciao
F
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958321#3958321
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958321
19 years, 9 months