|
|
Re: TENEO - ID is coming as null [message #1164111 is a reply to message #1163781] |
Thu, 31 October 2013 12:48 |
Chandre Gowda Messages: 56 Registered: April 2013 |
Member |
|
|
Thanks Martin.
Iam using autogenerated id(e_id).
I have set following cascade policy while intializing the DATASTORE.
PersistenceOptions.CASCADE_POLICY_ON_NON_CONTAINMENT, "REFRESH,PERSIST,MERGE".
The above error comes if i set following property as true.
PersistenceOptions.FETCH_ASSOCIATION_EXTRA_LAZY, "true"
If i set PersistenceOptions.FETCH_ASSOCIATION_EXTRA_LAZY as false,
then records will be inserted into superclass table(A) and association table.
But i will get other error as 'lazy initialization failed-session closed'.
SO i want to fetch all the attributes(including containement and noncontainement)
at once.
Am i missing any options that needs to be set during initialization..?
[Updated on: Thu, 31 October 2013 13:05] Report message to a moderator
|
|
|
Re: TENEO - ID is coming as null [message #1164723 is a reply to message #1164111] |
Thu, 31 October 2013 21:57 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Chandre,
The extra lazy option is for performance reasons. So I guess you should first get everything working without this and
other options. Setting cascade options makes sense.
I think it is best if you first increase your hibernate knowledge. It seems that most questions are related on how to
handle association loading and such. There are many blog posts on various hibernate topics on the net.
Also read the Hibernate docs thoroughly and search for things like long transactions/sessions, or this one:
https://community.jboss.org/wiki/OpenSessionInView
gr. Martin
On 10/31/2013 01:48 PM, Chandre Gowda wrote:
> Thanks Martin. I have set following cascade policy while intializing the DATASTORE.
>
> PersistenceOptions.CASCADE_POLICY_ON_NON_CONTAINMENT, "REFRESH,PERSIST,MERGE".
>
> The above error comes if i set following property as true.
> PersistenceOptions.FETCH_ASSOCIATION_EXTRA_LAZY, "true"
>
> If i set PersistenceOptions.FETCH_ASSOCIATION_EXTRA_LAZY as false, then records will be inserted into superclass
> table(A) and association table.
> But i will get other error as 'lazy initialization failed-session closed'.
> SO i want to fetch all the attributes(including containement and noncontainement)
> at once.
>
> Am i missing any options that needs to be set during initialization..?
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
|
|
|
|
|
|
Re: TENEO - ID is coming as null [message #1221230 is a reply to message #1221219] |
Tue, 17 December 2013 07:04 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Chandre,
It was mentioned in this wiki page, but I changed the wording a bit to make it more explicit, see the (new) second
paragraph here:
https://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Annotations_Format#JPA_Annotations_in_XML
You don't need to edit the ecore manually, you can also add eannotations in the ecore editor, right click on different
nodes, there should be an option to add an eannotation child somewhere.
gr. Martin
On 12/17/2013 07:22 AM, Chandre Gowda wrote:
> Thanks Martin.
> I have edited ecore in text editor and placed following code for that attribute.
>
> <eAnnotations source="teneo.jpa">
> <details key="appinfo" value="@OneToMany(fetch=FetchType.EAGER)"/>
> </eAnnotations>.
>
> Its working now. The attribute is loading eagerly. However I couldn't understand the other way of annotating i.e through
> XML files.
> How do we link ecore model and xml file ?
>
>
> Thanks
> Chandru
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
Powered by
FUDForum. Page generated in 0.02919 seconds