Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confused about JPA behavior

 
Carlos ninguno
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if I am misunderstanding the architecrure or the model of an ORM or if my vision is not the correct approach to solve my problem thats why I am posting this, I don't understand why the pagination is so difficult in a ORM, my situation is this: I have a parent with a one to many relation, so when I annotated that relation to be lazy loaded there is no a standard mechanism to retrive X number of children (because I can have 1,100,1000,100000 children), in my investigation I found that Hibernate has an annnotation "BatchSize" and EclipseLink has some parameter or hint too, but I couldn't find any method for paging a very large collection of children in JPA, I found some kind of parcial manners to doing in Hibernate (with something called filters for example) but it is complex and I am not sure if that is really the best way to do it... I think that a requirement like this is a common one in an Enterprise Application so this is the point where I am confused, an Enterprise platform like "Java EE" does not provide some mechanism for this kind of problem? or am I doing something wrong?

thank you.

 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the OneToMany is too big to read, then do not map it.

Instead query for it. On the Query you can set a firstResult/maxResults.
 
Carlos ninguno
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok I think i'll do that thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic