Skip to main content



      Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » hibernate and collection setters
hibernate and collection setters [message #87877] Mon, 02 July 2007 22:33 Go to next message
Eclipse UserFriend
Originally posted by: jerry_frain.yahoo.com

Ok, this has to be a FAQ but I can't find the answer after digging
around for quite a while.

When I generate my Java code from an ecore model the collection
attributes don't have setters. I believe that this is well known.

When I use teneo to generate hibernate mappings, the default
PropertyAccessors don't understand that there's no setter implementation
for my collections, so I get exceptions about setters not being defined.

I could write my own PropertyAccessor, but surely this problem has
already been solved?

Thanks,

Jerry
Re: hibernate and collection setters [message #87893 is a reply to message #87877] Mon, 02 July 2007 22:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jerry_frain.yahoo.com

Jerry Frain wrote:
> Ok, this has to be a FAQ but I can't find the answer after digging
> around for quite a while.
>
> When I generate my Java code from an ecore model the collection
> attributes don't have setters. I believe that this is well known.
>
> When I use teneo to generate hibernate mappings, the default
> PropertyAccessors don't understand that there's no setter implementation
> for my collections, so I get exceptions about setters not being defined.
>
> I could write my own PropertyAccessor, but surely this problem has
> already been solved?

BTW, it would probably help if I'd say that I'm persisting EMF objects
myself, by using the teneo-generated hibernate mappings and a DAO
pattern (for the moment). I'm guessing that everyone else is using the
HbDataStore.

Thanks,

Jerry
Re: hibernate and collection setters [message #87924 is a reply to message #87893] Tue, 03 July 2007 03:32 Go to previous message
Eclipse UserFriend
Hi Jerry,
The HbDataStore also does some behind-the-scenes Hibernate configuration. You can check out the
initializeDataStore method to see what happens. One of the things it does is set a specific tuplizer
for each persistentclass. The one used by Teneo is the EMFTuplizer. This tuplizer takes care of
assigning the correct propertyaccessor to each property.
See also the HbUtil.getPropertyAccessor method.

The propertyaccessors can be found in org.eclipse.emf.teneo.hibernate.mapping package and its
subclasses.

The main purpose of the HbDataStore is to configure hibernate and not much more. You can use the
HbDataStore in combination with your dao pattern. Just initialize the hbdatastore, get its
sessionfactory and for the rest use your dao's.

gr. Martin

Jerry Frain wrote:
> Jerry Frain wrote:
>> Ok, this has to be a FAQ but I can't find the answer after digging
>> around for quite a while.
>>
>> When I generate my Java code from an ecore model the collection
>> attributes don't have setters. I believe that this is well known.
>>
>> When I use teneo to generate hibernate mappings, the default
>> PropertyAccessors don't understand that there's no setter
>> implementation for my collections, so I get exceptions about setters
>> not being defined.
>>
>> I could write my own PropertyAccessor, but surely this problem has
>> already been solved?
>
> BTW, it would probably help if I'd say that I'm persisting EMF objects
> myself, by using the teneo-generated hibernate mappings and a DAO
> pattern (for the moment). I'm guessing that everyone else is using the
> HbDataStore.
>
> Thanks,
>
> Jerry


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: hibernate and collection setters [message #608624 is a reply to message #87877] Mon, 02 July 2007 22:41 Go to previous message
Eclipse UserFriend
Originally posted by: jerry_frain.yahoo.com

Jerry Frain wrote:
> Ok, this has to be a FAQ but I can't find the answer after digging
> around for quite a while.
>
> When I generate my Java code from an ecore model the collection
> attributes don't have setters. I believe that this is well known.
>
> When I use teneo to generate hibernate mappings, the default
> PropertyAccessors don't understand that there's no setter implementation
> for my collections, so I get exceptions about setters not being defined.
>
> I could write my own PropertyAccessor, but surely this problem has
> already been solved?

BTW, it would probably help if I'd say that I'm persisting EMF objects
myself, by using the teneo-generated hibernate mappings and a DAO
pattern (for the moment). I'm guessing that everyone else is using the
HbDataStore.

Thanks,

Jerry
Re: hibernate and collection setters [message #608626 is a reply to message #87893] Tue, 03 July 2007 03:32 Go to previous message
Eclipse UserFriend
Hi Jerry,
The HbDataStore also does some behind-the-scenes Hibernate configuration. You can check out the
initializeDataStore method to see what happens. One of the things it does is set a specific tuplizer
for each persistentclass. The one used by Teneo is the EMFTuplizer. This tuplizer takes care of
assigning the correct propertyaccessor to each property.
See also the HbUtil.getPropertyAccessor method.

The propertyaccessors can be found in org.eclipse.emf.teneo.hibernate.mapping package and its
subclasses.

The main purpose of the HbDataStore is to configure hibernate and not much more. You can use the
HbDataStore in combination with your dao pattern. Just initialize the hbdatastore, get its
sessionfactory and for the rest use your dao's.

gr. Martin

Jerry Frain wrote:
> Jerry Frain wrote:
>> Ok, this has to be a FAQ but I can't find the answer after digging
>> around for quite a while.
>>
>> When I generate my Java code from an ecore model the collection
>> attributes don't have setters. I believe that this is well known.
>>
>> When I use teneo to generate hibernate mappings, the default
>> PropertyAccessors don't understand that there's no setter
>> implementation for my collections, so I get exceptions about setters
>> not being defined.
>>
>> I could write my own PropertyAccessor, but surely this problem has
>> already been solved?
>
> BTW, it would probably help if I'd say that I'm persisting EMF objects
> myself, by using the teneo-generated hibernate mappings and a DAO
> pattern (for the moment). I'm guessing that everyone else is using the
> HbDataStore.
>
> Thanks,
>
> Jerry


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:Handling of very large model instances using Teneo
Next Topic:[Teneo] howto refresh objects
Goto Forum:
  


Current Time: Sun Jun 08 01:18:00 EDT 2025

Powered by FUDForum. Page generated in 0.03660 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top