[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2007-02-22 Thread [EMAIL PROTECTED]
You cannot programatically set the eager/lazy setting. You either set it to EAGER and have it always fetch, or you set it to lazy and for those things (like servlets) that need to force an eager fetch, they would need to call into some SLSB or some such thing that performs a FETCH JOIN query.

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2007-02-22 Thread eiben
"[EMAIL PROTECTED]" wrote : You cannot programatically set the eager/lazy setting. You either set it to EAGER and have it always fetch, or you set it to lazy and for those things (like servlets) that need to force an eager fetch, they would need to call into some SLSB or some such thing that pe

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2007-02-22 Thread [EMAIL PROTECTED]
There's a lot of resources on the 'net that explain FETCH JOINs and its syntax. Bill Burke's EJB3 book also has a chapter on JPA Queries that is good. Google "FETCH JOIN". e.g. Here's a hibernate page that may be helpful. http://www.hibernate.org/hib_docs/reference/en/html/queryhql.html View t

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2007-02-22 Thread eiben
OK, thanx. So I got this thingy working. But now I have something like this, which also gives me an error, that the items are not yet fetched ... | Itemgroup myItemGroup = getItemDispatcher().findItemGroup(Integer.parseInt(request.getParameter("id"))); | | Collection myig = myItemGroup.

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2007-02-22 Thread [EMAIL PROTECTED]
So, Itemgroup has an items relationship that is lazy loaded. Your findItemGroup is only loading in the Itemgroup entity without doing any fetch joining or eagerly loading of that relationship, hence your error. you will need to have another method, "findItemGroupWithItems" or something like th

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2007-02-23 Thread eiben
"[EMAIL PROTECTED]" wrote : So, Itemgroup has an items relationship that is lazy loaded. Your findItemGroup is only loading in the Itemgroup entity without doing any fetch joining or eagerly loading of that relationship, hence your error. well, but I though when I access the items-collection t

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2007-02-23 Thread [EMAIL PROTECTED]
Every time you call "find" you are getting back a new attached instance initialized according to the lazy-loading properties of your entity, i.e. it will not have any relationship info that is set to LAZY. Even if you called that method from that servlet before. I believe the same behavior occ

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2007-02-23 Thread eiben
I see ... even though I'm not 100% satisfied with this answer :). As you figured, I wouold like to have a better integration into the presentation-layer. Then again: I'm currently working on a research-project, where I want to compare two different web-application-platforms (java vs. php), so I'

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2007-02-23 Thread eiben
but wait ... when I'm using SFSB and I make repeated calls, wouldn't that be like making those calls all from the same session bean? I mean ... I though using a SFSB in conjunction with an extended entity-manager should avoid that entities get detached. View the original post : http://www.jbos

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2007-02-23 Thread [EMAIL PROTECTED]
using extended persistence contexts can work also - which is how JBoss Seam does it, I believe. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021228#4021228 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021228 __

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2007-02-23 Thread eiben
well ... seems not. Or I'm doing something wrong :( That's what I read in some book, that using extened persistence and SFSB should overcome the problem of detaching entities. hmm ... View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021254#4021254 Reply to th

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2008-02-04 Thread amitvk
Another way I found useful was using the OOP concepts to load the mappings or just the core table vlaues. Have the main table mapped in the superclass and the mappings that you want to load sometimes in the subclass. e.g. If the table name is Customer. have 2 entities Customer, and Customer

[jboss-user] [EJB 3.0] - Re: eager vs. lazy fetching

2008-02-04 Thread amitvk
Another way I found useful was using the OOP concepts to load the mappings or just the core table vlaues. Have the main table mapped in the superclass and the mappings that you want to load sometimes in the subclass. e.g. If the table name is Customer. have 2 entities Customer, and CustomerWi