hibernate and collection setters [message #87877] |
Mon, 02 July 2007 22:33  |
Eclipse User |
|
|
|
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 #87924 is a reply to message #87893] |
Tue, 03 July 2007 03:32  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03427 seconds