|
|
|
Re: EList/List setter and iBatis [message #416783 is a reply to message #416771] |
Tue, 19 February 2008 10:10 |
Kai Schlamp Messages: 344 Registered: July 2009 |
Senior Member |
|
|
Hello Tom,
I never thought about that lazy loading problem.
I just use a setter like this:
public void setXXX(List<XXX> xxx) {
ECollections.setEList(this.xxx, xxx);
}
and thought, that everything would work this way.
But I am still more in the planning phase and now think about, if
perhaps teneo/hibernate would be a better solution (as I am also not
dependent on a given database schema).
Kai
Tom Schindl wrote:
> Hi Kai,
>
> I'm also using iBatis and add the method for setting the list my own. I
> don't think that this can be done automatically for some reasons.
>
> The most important one is that when setting the list directly from the
> outside lazy loading doesn't work any more. You need some tricks to make
> this work appropriately.
>
> My model looks like this:
>
> -------------8<-------------
> protected EList<Session> sessions; // The EMF-generated object
> private List<Session> orginalSession; // The object coming from iBatis
> // when using lazy loading it is a
> // proxy
>> /**
>> * <!-- begin-user-doc -->
>> * <!-- end-user-doc -->
>> */
>> public List<Session> getSessions() {
>> if (sessions == null) {
>> sessions = new
>> EObjectContainmentWithInverseEList<Session>(Session.class, this,
>> ingeniumPackage.CLIENT__SESSIONS, ingeniumPackage.SESSION__PERSON);
>>
>>
>> ChangeRecordManager.getManager().runWithoutChangeRecording(n ew
>> Runnable() {
>> public void run() {
>> if (orginalSession != null) {
>> sessions.addAll(orginalSession);
>> }
>> }
>> });
>> }
>>
>> return sessions;
>> }
>
> -------------8<-------------
>
> If you don't care about change recording you don't need the
> runWithoutChangeRecording. I my application I need this and have to
> suspend all registered change recorders while the lazy-loading is
> happening else my Editors and Views would report a wrong dirty-state.
>
> Did you find another solution to this problem?
>
> Tom
>
> Kai Schlamp schrieb:
>> Kai Schlamp wrote:
>>> As I use iBatis for persisting my EMF model to the database, the model
>>> needs also setters for list objects.
>>> I simply add those to the model by hand after code generation, like
>>> mentioned here:
>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg0 7053.html
>>>
>>> There was also a consideration to add an option for this to the
>>> generator model (back in 2004 mentioned here:
>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg0 7053.html)
>>
>> Sorry, i meant this link:
>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg0 7056.html
>>
>>
>>> I searched Bugzilla for an enhancement request, but didn't found
>>> anything. Did I miss something? Is that option perhaps somewhere there?
>>> Or was this idea dropped?
>>>
>>> Kai
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02741 seconds