Visual Paradigm Logo
     Build Quality Applications Faster, Better and Cheaper
 
Home | Products | Download | Documentation | Support | Resources | Partners | Quick Tour | Shop | Company |  
 
   Visual Paradigm Discussion Forum
  Login   [ Register ] Email: Password: Log me on automatically I lost my password  
Recent Topics
Advanced Search
Lazy initialization on collection  
Forum Index -> DB Visual ARCHITECT (DB-VA)
Author Message
distansia


Joined: 2007/10/16
Messages: 59

Offline

Hi VP,

Just a question, is it possible to Add an object to a persistent collection (like hashedset) without lazily initializing it?

I mean:

Code:
NET C#:
 Class1.MyCollection.Add(myNewObject)

This causes the "MyCollection" to be initialized... just for adding only a new item. If collection is huge... then the process takes "ages".

Is it possible to avoid this initialization, or at least limit the result set to, say 10 or few records?

BTW for your info, when dealing with this problem I also found that when you manually set the cascade behavior of both roles of an association to "none", when adding an element and later on do a DAO.Save(object), a persistent exception is thrown with the message: "Failed to lazily initialize a collection - no session" . But... a session was "alive".

I did not "catch" the origin of that problem yet, I will let you know if I can reproduce in a simple model.

Many thanks for your info
(I'm using DBVA latest build by now: 20071116h)
 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

Hello distansia,

Let me ask our developers first. Will let you know the answer shortly.

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

Hi distansia,

is it possible to Add an object to a persistent collection (like hashedset) without lazily initializing it? 

It seems that it is not possible, because it is the NHibernate's lazy collection implementation.

Concerning the problem "Failed to lazily initialize a collection - no session", we are unable to reproduce it. Could ou send me your project and test case? This is my Email address:
jick@visual-paradigm.com

Please also answer the questions below in order for us to reproduce the problem:
=> What session type are you using? It is THREAD_BASE by default. But you may customize it in the generated persistent manager.
=> Where was the session came from? getting from the persistent manager? or get from httpSession (web application)?
=> You said that the session was "alive", is this session the one connected by the collection? (I mean the session for loading the collection owner object)

We look forward to hearing from you.

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
distansia


Joined: 2007/10/16
Messages: 59

Offline

Jick wrote:
Concerning the problem "Failed to lazily initialize a collection - no session", we are unable to reproduce it. Could ou send me your project and test case? This is my Email address:
jick@visual-paradigm.com
 


Hi Jick,

The evaluation period at my company ended few days ago, but I will continue helping you with this problem from home. Please be patient because now I will have less time available for this software, but sure I will.

My final verdict about your software is 4/5 **** on features needed by us, and 5/5 ***** (if not 6/5) on support

I will contact you as soon as I can about this problem. But I think it was caused mainly by bad code I should made at the beginning of the evaluation.

Many thanks for all your effort!!
 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

Hi distansia,

Oh, I didn't really remember you are an evaluation user. You really did a lot to help us improve. We can't thank you enough!

Many thanks for all your effort as well !!!!!

Bet regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
distansia


Joined: 2007/10/16
Messages: 59

Offline

Jick wrote:
Please also answer the questions below in order for us to reproduce the problem:
=> What session type are you using? It is THREAD_BASE by default. But you may customize it in the generated persistent manager.
=> Where was the session came from? getting from the persistent manager? or get from httpSession (web application)?
=> You said that the session was "alive", is this session the one connected by the collection? (I mean the session for loading the collection owner object)
 


Hi Jick,

Sorry for being too late. Now I have no much free time to test things, but I will try.

Concerning the error message, I have not found it... yet. But, I can answer some of your questions:

-Session Type: THREAD_BASE (you were right)
-The session went from the PersistentManager (the test application is a Windows Forms one)

BTW, I am using "DAO Factory (with Interface)" when generating ORM Code, if it helps.

Anyway, I will mail you when I see that error message again.

Jick wrote:
You really did a lot to help us improve. We can't thank you enough! 

Thanks!! You did a lot too to improve things quickly! your support impressed us a lot
 
 
   Forum Index -> DB Visual ARCHITECT (DB-VA)
Go to:   
Powered by JForum 2.1.4 © 2005 - Rafael Steil