Re: Wicket-Hibernate Related LazyInitializationException

2010-12-07 Thread nivs
this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Hibernate-Related-LazyInitializationException-tp3068534p3075946.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-07 Thread nivs
Eelco Thanks again for your thoughts. Inline with this, I will look at optimizing it and intend to switch to using LDM's. Cheers Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Hibernate-Related-LazyInitializationException-tp3068534p3076005.html Sent from

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-06 Thread Nivedan Nadaraj
Hi Eelco Appreciate your time and thoughts. I guess I am going to have to look at LDM approach, since from what yourself,James and Dan have already mentioned that. I noticed a pattern when it/the system throws the Exception I have to track it closely and see if makes sense and then I guess have

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-05 Thread Nivedan Nadaraj
H Vineet Thanks for taking the time again to respond. I appreciate every single moment you have sent. The reason why I add the Phone Number to a list is that, I only want to save those numbers when the user hits the Save Button for the Person as a whole. Lets say a Person X is looked up and

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-05 Thread Nivedan Nadaraj
Hi james, Yes from the DAO after i get the person and his SetPhone I map them into a ArrayList and is set into a Value Object that is returned to the client/caller. On the front end I use this List to render and then update this list based on user action. When user wants to Save/Update, i map

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-05 Thread Nivedan Nadaraj
Hi Eelco Appreciate your time and thoughts. I guess I am going to look at LDM approach, since from what yourself,James and Dan have already mentioned that. Hmm...well guess you guys have pointed me the required stuff to work on will get back with more details hopefully with the solution. Many

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-03 Thread Nivedan Nadaraj
Hi Yeah so at present, what I do is when the user 1. Adds a new phone number, I add this to the existing list of phoneNumbers in the UI but yet to be persisted 2. User now clicks Save - This saves the Main object ie a Person and since the new phone number is added to the collection while I save

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-03 Thread Nivedan Nadaraj
Dan, Thanks mate. I am yet to digest all that. I am going to get back to you and see if it all helped. Thank you for the time Cheers niv On Fri, Dec 3, 2010 at 1:06 AM, Dan Retzlaff dretzl...@gmail.com wrote: Yes, copying entities from the entity's association collection into another

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-03 Thread vineet semwal
afaik problem is you are doing form.getmodelobject(),that form could be ajax submitted and so you are trying to initialize associate collection in different session.. i don't understand your 1. and 2. why are you adding to list when user has not clicked on save ? i think adding a new phone

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-03 Thread James Carman
Why not read the phones into a different list that you edit and when you're done, you update the entity. On Fri, Dec 3, 2010 at 2:20 AM, Nivedan Nadaraj shravann...@gmail.com wrote: Vineet I have not tried that. In this scenario, it will overwrite the phone's the user may have added to a list

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-03 Thread Eelco Hillenius
Yep, or least something comparable. You need to re-attach those objects you're using to the session somehow, and often the easiest way to do that is to just load them again if they were previously detached. If you worry about the database being hit more than you want, you are probably prematurely

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-02 Thread vineet semwal
do you see the exception when you try this? @Override protected Object load() { // return containerForm.getModelObject().getPhoneList(); return service.getRequiredObject(*).getPhoneList(); //or any thing like it .. } On Thu, Dec 2, 2010 at 12:12 PM,

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-02 Thread Dan Retzlaff
Yes, copying entities from the entity's association collection into another collection will initialize the collection. If you're still getting an LIE, there may be another association at play (a child of Phone?). Note that I don't fully endorse the session reattachment aspect I posted. Not only

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-02 Thread Nivedan Nadaraj
Vineet I have not tried that. In this scenario, it will overwrite the phone's the user may have added to a list on the UI and is yet to be persisted. If you know what I mean. 1, Initial fetch of Subject along with his phones ( 5 items) 2. User adds a new phone number to the subject ( 5 + 1 (yet

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-02 Thread vineet semwal
afaik,if your collection is lazy ,you will be able to initialize it in the same session .. if you are trying to initialize it in a new/different session you will not be able to initialize it.. what i did was making sure that you have a associate collection which is in the same session.. i think

Wicket-Hibernate Related LazyInitializationException

2010-12-01 Thread Nivedan Nadaraj
Hi All I am guessing this is more of a Hibernate thing/issue but if some one has encountered this and has a explanation that I can probably use from the Wicket front would be great. https://forum.hibernate.org/viewtopic.php?f=1t=1008473 I have a LazyIntializationException when i page through

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-01 Thread Dan Retzlaff
Hi Nivedan, Even though the subsequent requests have a Session open, the entities with the uninitialized collections don't know about it. I'm sure if you track it down, you can explain the intermittent behavior by prior access to the collection when the original session is open. I'd say you can

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-01 Thread James Carman
Just make sure your form's model is a LDM too. On Thu, Dec 2, 2010 at 12:23 AM, Nivedan Nadaraj shravann...@gmail.com wrote: Hi All I am guessing this is more of a Hibernate thing/issue but if some one has encountered this and has a explanation that I can probably use from the Wicket front

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-01 Thread Nivedan Nadaraj
Hi Dan, Thanks for your time most appreciated. 1. Option 1 as you may agree, not always is a good thing to do so I would drop that. 2. Option 2 - I have tried this in the following manner. As part of the look up for the Subjects via the DAO, I iterate through the list of Person.Phones

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-01 Thread Nivedan Nadaraj
Hi James Thanks for the time. I use the CPM for the whole use case. Mmm..is LDM mandatory for such a use case? Am open for thoughts just want the best way to implement it. Can you explain a bit further what your thought was please? Thank you Regards On Thu, Dec 2, 2010 at 2:13 PM, James