Skip to main content



      Home
Home » Modeling » EMF » Teneo: Storing null in EAV schema
Teneo: Storing null in EAV schema [message #496955] Wed, 11 November 2009 15:46 Go to next message
Eclipse UserFriend
When using Teneo with EAV schema, I seem to be unable to store an EObject if the value for one of its EStructuralFeature's is null. I get the following exception:

org.hibernate.PropertyValueException: not-null property references a null or transient value: EAVSingleEAttributeValueHolder.mandatoryValue

I tried to make the property nullable by adding an annotation to the XSD from which the ecore model is created, eg.

<xsd:element name="Number" type="xsd:integer">
<xsd:annotation>
<xsd:appinfo source="teneo.jpa">@Column(name="Number",nullable="true ")</xsd:appinfo>
</xsd:annotation>
</xsd:element>

However, this does not fix the problem. Does anyone know how to make this work?
Re: Teneo: Storing null in EAV schema [message #496956 is a reply to message #496955] Wed, 11 November 2009 16:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi Andrew,
With an EAV mapping most (I would even say all) jpa annotations are ignored. In this case (afaics) the xsd element has
minOccurs=1 (the default). This means that for ecore (and Teneo) it is a mandatory feature which must have a value. The
EAVSingleEAttributeValueHolder.mandatoryValue field is used to enforce required/mandatory constraints.

So in this case it can be solved by adding minOccurs="0" to the xsd element.

gr. Martin

Andrew wrote:
> When using Teneo with EAV schema, I seem to be unable to store an
> EObject if the value for one of its EStructuralFeature's is null. I get
> the following exception:
>
> org.hibernate.PropertyValueException: not-null property references a
> null or transient value: EAVSingleEAttributeValueHolder.mandatoryValue
>
> I tried to make the property nullable by adding an annotation to the XSD
> from which the ecore model is created, eg.
>
> <xsd:element name="Number" type="xsd:integer">
> <xsd:annotation>
> <xsd:appinfo source="teneo.jpa">@Column(name="Number",nullable="true
> ")</xsd:appinfo>
> </xsd:annotation>
> </xsd:element>
>
> However, this does not fix the problem. Does anyone know how to make
> this work?


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Teneo: Storing null in EAV schema [message #496964 is a reply to message #496956] Wed, 11 November 2009 17:19 Go to previous message
Eclipse UserFriend
Yes, that fixes it. Thanks!
Previous Topic:Re: [Teneo] how to supress Teneo-Output to console
Next Topic:[CDO] Re: Slide ESE 2009
Goto Forum:
  


Current Time: Fri Nov 07 11:55:41 EST 2025

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

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

Back to the top