Mihail Stoynov's blog!
Surrender your ego
Tuesday, April 29, 2008
JPA (Hibernate), EJBs, and WebServices interface.
Here's the design:
EJBs for business logic, JPA @Enitities for object (domain) model, Web services for a public interface.
The model is quite complex.
Even in the presentation (web services) I use the entities model.
The problem comes from that in the presentation a call is made to an EJB. The EJB returns an entity which after the call is ended gets disconnected. So all collections (@OneToMany) cannot be loaded.
EAGER fetching was the solution but then half of the database was loaded on a single method call. And eventually I got to a really ugly
MySQL limitation
(A query with more than 61 joins (inner selects + cases + at least 40 left outer joins) and a length of 436 lines.
Now before returing the entity in the EJB method via Reflection I initialize all the collections I need. Ugly.
What I need and would perfectly fit me would be an eager fetching only until some level of deepness is reached, then switch to lazy. Then a level of 2 or 3 would be perfect.
Currently I don't of something like that existing.
If someone has an idea, please let me know.
Comments [0]
|
Trackback
OpenID
Please login with either your
OpenID
above, or your details below.
Name
E-mail
(will show your
gravatar
icon)
Home page
Remember Me
Comment (Some html is allowed:
a@href@title, blockquote@cite, strike
) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.
Enter the code shown (prevents robots):
Live Comment Preview
dasBlog theme by
Mads Kristensen
RSS feed
Search
Archives
November, 2008 (15)
October, 2008 (16)
September, 2008 (30)
August, 2008 (15)
July, 2008 (14)
June, 2008 (26)
May, 2008 (6)
April, 2008 (21)
March, 2008 (14)
February, 2008 (28)
November, 2007 (5)
October, 2007 (7)
September, 2007 (1)
August, 2007 (7)
July, 2007 (3)
June, 2007 (1)
Blog Stats
Total Posts: 203
This Year: 179
This Month: 0
This Week: 0
Comments: 80
Categories
Did you know
Java
rulez
Sucks
БГ
Blogroll
Michael Moore (no rss)
Links
BG-JUG
Copyright policy
No rights reserved.
(You are going to
copy stuff anyway :)
If you mention my
name, thank you.
2008, Mihail Stoynov