Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [teneo] XML(Gregorian)Calendar or GregorianCalendar
[teneo] XML(Gregorian)Calendar or GregorianCalendar [message #85609] Wed, 06 June 2007 14:56 Go to next message
Paul Gardiner is currently offline Paul GardinerFriend
Messages: 94
Registered: July 2009
Member
Is it possible to use a GregorianCalendar or XMLGregorianCalendar or
XMLCalendar using Teneo/Hibernate? Date seems to work fine, but I get
exceptions such as :

The value '2007-06-06T14:42:43Z' is
invalid.">java.lang.IllegalArgumentException: The value
'2007-06-06T14:42:43Z' is invalid. at
org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:439)
at . . .

Whenever I try to use an XMLCalendar. I get something similar for the other
types. I am setting the XMLTypePackages in my HbDataStore.setEPackages()
method, which I think is correct.
Re: [teneo] XML(Gregorian)Calendar or GregorianCalendar [message #85638 is a reply to message #85609] Wed, 06 June 2007 16:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Paul,

I recently changed this
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=190666) so that the
validation is no longer done during construction but rather as a
validation step later. I've noticed it's quite common to end up with a
"dateTime" type of result when only a "date" is expected...


Paul Gardiner wrote:
> Is it possible to use a GregorianCalendar or XMLGregorianCalendar or
> XMLCalendar using Teneo/Hibernate? Date seems to work fine, but I get
> exceptions such as :
>
> The value '2007-06-06T14:42:43Z' is
> invalid.">java.lang.IllegalArgumentException: The value
> '2007-06-06T14:42:43Z' is invalid. at
> org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:439)
> at . . .
>
> Whenever I try to use an XMLCalendar. I get something similar for the other
> types. I am setting the XMLTypePackages in my HbDataStore.setEPackages()
> method, which I think is correct.
>
>
>
Re: [teneo] XML(Gregorian)Calendar or GregorianCalendar [message #85678 is a reply to message #85638] Wed, 06 June 2007 21:20 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Paul,
I would need a longer stack trace to really comment on this. Teneo should be able to support this.

As an example from a testcase I have:
This xsd:
<complexType name="TestDate">
<sequence>
<element name="date" type="date"></element>
<element name="datetime" type="dateTime"></element>
</sequence>
</complexType>

Results in this ecore:
<eStructuralFeatures xsi:type="ecore:EAttribute" name="date" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Date">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="date"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="datetime" unique="false"
lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//DateTime">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="datetime"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>


Which results in this hbm:

<property name="date" lazy="false" insert="true" update="true" not-null="true" unique="false"
type="org.eclipse.emf.teneo.hibernate.mapping.XSDDate">
<column not-null="true" unique="false" name="`date`"/>
</property>
<property name="datetime" lazy="false" insert="true" update="true" not-null="true" unique="false"
type="org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime">
<column not-null="true" unique="false" name="`datetime`"/>
</property>

gr. Martin

Ed Merks wrote:
> Paul,
>
> I recently changed this
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=190666) so that the
> validation is no longer done during construction but rather as a
> validation step later. I've noticed it's quite common to end up with a
> "dateTime" type of result when only a "date" is expected...
>
>
> Paul Gardiner wrote:
>> Is it possible to use a GregorianCalendar or XMLGregorianCalendar or
>> XMLCalendar using Teneo/Hibernate? Date seems to work fine, but I get
>> exceptions such as :
>>
>> The value '2007-06-06T14:42:43Z' is
>> invalid.">java.lang.IllegalArgumentException: The value
>> '2007-06-06T14:42:43Z' is invalid. at
>> org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:439)
>> at . . .
>>
>> Whenever I try to use an XMLCalendar. I get something similar for the
>> other types. I am setting the XMLTypePackages in my
>> HbDataStore.setEPackages() method, which I think is correct.
>>
>>


--

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: [teneo] XML(Gregorian)Calendar or GregorianCalendar [message #85798 is a reply to message #85678] Thu, 07 June 2007 14:28 Go to previous messageGo to next message
Paul Gardiner is currently offline Paul GardinerFriend
Messages: 94
Registered: July 2009
Member
Before I send a stack trace, what type should I be using for dates/times?
My preference is GregorianCalendar, but I'm not sure if it's supported. Do
I need to add any specific ePackage? Also, do I need a type attribute on my
@model annotation?

"Martin Taal" <mtaal@elver.org> wrote in message
news:f478et$d1h$1@build.eclipse.org...
> Hi Paul,
> I would need a longer stack trace to really comment on this. Teneo should
> be able to support this.
>
> As an example from a testcase I have:
> This xsd:
> <complexType name="TestDate">
> <sequence>
> <element name="date" type="date"></element>
> <element name="datetime" type="dateTime"></element>
> </sequence>
> </complexType>
>
> Results in this ecore:
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="date"
> unique="false" lowerBound="1"
> eType="ecore:EDataType
> http://www.eclipse.org/emf/2003/XMLType#//Date">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="date"/>
> <details key="namespace" value="##targetNamespace"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="datetime"
> unique="false"
> lowerBound="1" eType="ecore:EDataType
> http://www.eclipse.org/emf/2003/XMLType#//DateTime">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="datetime"/>
> <details key="namespace" value="##targetNamespace"/>
> </eAnnotations>
> </eStructuralFeatures>
>
>
> Which results in this hbm:
>
> <property name="date" lazy="false" insert="true" update="true"
> not-null="true" unique="false"
> type="org.eclipse.emf.teneo.hibernate.mapping.XSDDate">
> <column not-null="true" unique="false" name="`date`"/>
> </property>
> <property name="datetime" lazy="false" insert="true" update="true"
> not-null="true" unique="false"
> type="org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime">
> <column not-null="true" unique="false" name="`datetime`"/>
> </property>
>
> gr. Martin
>
> Ed Merks wrote:
>> Paul,
>>
>> I recently changed this
>> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=190666) so that the
>> validation is no longer done during construction but rather as a
>> validation step later. I've noticed it's quite common to end up with a
>> "dateTime" type of result when only a "date" is expected...
>>
>>
>> Paul Gardiner wrote:
>>> Is it possible to use a GregorianCalendar or XMLGregorianCalendar or
>>> XMLCalendar using Teneo/Hibernate? Date seems to work fine, but I get
>>> exceptions such as :
>>>
>>> The value '2007-06-06T14:42:43Z' is
>>> invalid.">java.lang.IllegalArgumentException: The value
>>> '2007-06-06T14:42:43Z' is invalid. at
>>> org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:439)
>>> at . . .
>>>
>>> Whenever I try to use an XMLCalendar. I get something similar for the
>>> other types. I am setting the XMLTypePackages in my
>>> HbDataStore.setEPackages() method, which I think is correct.
>>>
>>>
>
>
> --
>
> 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: [teneo] XML(Gregorian)Calendar or GregorianCalendar [message #85825 is a reply to message #85798] Fri, 08 June 2007 12:35 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
I just use the Date class myself.
I think also gregorian calendar is supported by Hibernate, you can try.
If it does not work then you need to create your own hibernate usertype and set a @Type/@TypeDef
annotation on the edatatype/eattribute having this.

gr. Martin

Paul Gardiner wrote:
> Before I send a stack trace, what type should I be using for dates/times?
> My preference is GregorianCalendar, but I'm not sure if it's supported. Do
> I need to add any specific ePackage? Also, do I need a type attribute on my
> @model annotation?
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:f478et$d1h$1@build.eclipse.org...
>> Hi Paul,
>> I would need a longer stack trace to really comment on this. Teneo should
>> be able to support this.
>>
>> As an example from a testcase I have:
>> This xsd:
>> <complexType name="TestDate">
>> <sequence>
>> <element name="date" type="date"></element>
>> <element name="datetime" type="dateTime"></element>
>> </sequence>
>> </complexType>
>>
>> Results in this ecore:
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="date"
>> unique="false" lowerBound="1"
>> eType="ecore:EDataType
>> http://www.eclipse.org/emf/2003/XMLType#//Date">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="element"/>
>> <details key="name" value="date"/>
>> <details key="namespace" value="##targetNamespace"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="datetime"
>> unique="false"
>> lowerBound="1" eType="ecore:EDataType
>> http://www.eclipse.org/emf/2003/XMLType#//DateTime">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="element"/>
>> <details key="name" value="datetime"/>
>> <details key="namespace" value="##targetNamespace"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>>
>>
>> Which results in this hbm:
>>
>> <property name="date" lazy="false" insert="true" update="true"
>> not-null="true" unique="false"
>> type="org.eclipse.emf.teneo.hibernate.mapping.XSDDate">
>> <column not-null="true" unique="false" name="`date`"/>
>> </property>
>> <property name="datetime" lazy="false" insert="true" update="true"
>> not-null="true" unique="false"
>> type="org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime">
>> <column not-null="true" unique="false" name="`datetime`"/>
>> </property>
>>
>> gr. Martin
>>
>> Ed Merks wrote:
>>> Paul,
>>>
>>> I recently changed this
>>> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=190666) so that the
>>> validation is no longer done during construction but rather as a
>>> validation step later. I've noticed it's quite common to end up with a
>>> "dateTime" type of result when only a "date" is expected...
>>>
>>>
>>> Paul Gardiner wrote:
>>>> Is it possible to use a GregorianCalendar or XMLGregorianCalendar or
>>>> XMLCalendar using Teneo/Hibernate? Date seems to work fine, but I get
>>>> exceptions such as :
>>>>
>>>> The value '2007-06-06T14:42:43Z' is
>>>> invalid.">java.lang.IllegalArgumentException: The value
>>>> '2007-06-06T14:42:43Z' is invalid. at
>>>> org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:439)
>>>> at . . .
>>>>
>>>> Whenever I try to use an XMLCalendar. I get something similar for the
>>>> other types. I am setting the XMLTypePackages in my
>>>> HbDataStore.setEPackages() method, which I think is correct.
>>>>
>>>>
>>
>> --
>>
>> 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
>
>
I

--

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
[teneo] XMLGregorianCalendar [message #85895 is a reply to message #85825] Sat, 09 June 2007 08:17 Go to previous messageGo to next message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
Hello, I have a similar problem:
There is a type in ecore model :
<eClassifiers xsi:type="ecore:EDataType" name="DateCategoriesCust"
instanceClassName="javax.xml.datatype.XMLGregorianCalendar" >
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="?"?
Re: [teneo] XMLGregorianCalendar [message #85913 is a reply to message #85895] Sat, 09 June 2007 09:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------040607090305070004080900
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Wolf,

This was a bug that we encountered earlier this week and should be fixed
in this weeks 2.3 build

https://bugs.eclipse.org/bugs/show_bug.cgi?id=191219

The problem only occurs on the Sun JDK and looks to be a bug in the JDK
where Sun's JDK doesn't implement .equals properly. It's never valid to
fail comparison with a cast cast exception. The equals implementation
of any subclass of XMLGregorianCalendard should be tolerant of any other
implementation of XMLGregorianCalendar rather than assume that only a
particular implementation is present. I'm not sure if there is a Sun
bug report about it...


wolf_roma wrote:
> Hello, I have a similar problem:
> There is a type in ecore model :
> <eClassifiers xsi:type="ecore:EDataType" name="DateCategoriesCust"
> instanceClassName="javax.xml.datatype.XMLGregorianCalendar" >
> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
> <details key="documentation" value="?"?
Re: [teneo] XMLGregorianCalendar [message #85941 is a reply to message #85913] Sat, 09 June 2007 11:32 Go to previous message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_0017_01C7AAAB.55685960
Content-Type: text/plain;
charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

Thanks, well work!
------=_NextPart_000_0017_01C7AAAB.55685960
Content-Type: text/html;
charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.3086" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Thanks, well =
work!</FONT></DIV></BODY></HTML>

------=_NextPart_000_0017_01C7AAAB.55685960--
Re: [teneo] XML(Gregorian)Calendar or GregorianCalendar [message #606874 is a reply to message #85609] Wed, 06 June 2007 16:54 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Paul,

I recently changed this
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=190666) so that the
validation is no longer done during construction but rather as a
validation step later. I've noticed it's quite common to end up with a
"dateTime" type of result when only a "date" is expected...


Paul Gardiner wrote:
> Is it possible to use a GregorianCalendar or XMLGregorianCalendar or
> XMLCalendar using Teneo/Hibernate? Date seems to work fine, but I get
> exceptions such as :
>
> The value '2007-06-06T14:42:43Z' is
> invalid.">java.lang.IllegalArgumentException: The value
> '2007-06-06T14:42:43Z' is invalid. at
> org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:439)
> at . . .
>
> Whenever I try to use an XMLCalendar. I get something similar for the other
> types. I am setting the XMLTypePackages in my HbDataStore.setEPackages()
> method, which I think is correct.
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [teneo] XML(Gregorian)Calendar or GregorianCalendar [message #606879 is a reply to message #85638] Wed, 06 June 2007 21:20 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Paul,
I would need a longer stack trace to really comment on this. Teneo should be able to support this.

As an example from a testcase I have:
This xsd:
<complexType name="TestDate">
<sequence>
<element name="date" type="date"></element>
<element name="datetime" type="dateTime"></element>
</sequence>
</complexType>

Results in this ecore:
<eStructuralFeatures xsi:type="ecore:EAttribute" name="date" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Date">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="date"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="datetime" unique="false"
lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//DateTime">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="datetime"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>


Which results in this hbm:

<property name="date" lazy="false" insert="true" update="true" not-null="true" unique="false"
type="org.eclipse.emf.teneo.hibernate.mapping.XSDDate">
<column not-null="true" unique="false" name="`date`"/>
</property>
<property name="datetime" lazy="false" insert="true" update="true" not-null="true" unique="false"
type="org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime">
<column not-null="true" unique="false" name="`datetime`"/>
</property>

gr. Martin

Ed Merks wrote:
> Paul,
>
> I recently changed this
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=190666) so that the
> validation is no longer done during construction but rather as a
> validation step later. I've noticed it's quite common to end up with a
> "dateTime" type of result when only a "date" is expected...
>
>
> Paul Gardiner wrote:
>> Is it possible to use a GregorianCalendar or XMLGregorianCalendar or
>> XMLCalendar using Teneo/Hibernate? Date seems to work fine, but I get
>> exceptions such as :
>>
>> The value '2007-06-06T14:42:43Z' is
>> invalid.">java.lang.IllegalArgumentException: The value
>> '2007-06-06T14:42:43Z' is invalid. at
>> org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:439)
>> at . . .
>>
>> Whenever I try to use an XMLCalendar. I get something similar for the
>> other types. I am setting the XMLTypePackages in my
>> HbDataStore.setEPackages() method, which I think is correct.
>>
>>


--

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: [teneo] XML(Gregorian)Calendar or GregorianCalendar [message #606887 is a reply to message #85678] Thu, 07 June 2007 14:28 Go to previous message
Paul Gardiner is currently offline Paul GardinerFriend
Messages: 94
Registered: July 2009
Member
Before I send a stack trace, what type should I be using for dates/times?
My preference is GregorianCalendar, but I'm not sure if it's supported. Do
I need to add any specific ePackage? Also, do I need a type attribute on my
@model annotation?

"Martin Taal" <mtaal@elver.org> wrote in message
news:f478et$d1h$1@build.eclipse.org...
> Hi Paul,
> I would need a longer stack trace to really comment on this. Teneo should
> be able to support this.
>
> As an example from a testcase I have:
> This xsd:
> <complexType name="TestDate">
> <sequence>
> <element name="date" type="date"></element>
> <element name="datetime" type="dateTime"></element>
> </sequence>
> </complexType>
>
> Results in this ecore:
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="date"
> unique="false" lowerBound="1"
> eType="ecore:EDataType
> http://www.eclipse.org/emf/2003/XMLType#//Date">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="date"/>
> <details key="namespace" value="##targetNamespace"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="datetime"
> unique="false"
> lowerBound="1" eType="ecore:EDataType
> http://www.eclipse.org/emf/2003/XMLType#//DateTime">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="datetime"/>
> <details key="namespace" value="##targetNamespace"/>
> </eAnnotations>
> </eStructuralFeatures>
>
>
> Which results in this hbm:
>
> <property name="date" lazy="false" insert="true" update="true"
> not-null="true" unique="false"
> type="org.eclipse.emf.teneo.hibernate.mapping.XSDDate">
> <column not-null="true" unique="false" name="`date`"/>
> </property>
> <property name="datetime" lazy="false" insert="true" update="true"
> not-null="true" unique="false"
> type="org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime">
> <column not-null="true" unique="false" name="`datetime`"/>
> </property>
>
> gr. Martin
>
> Ed Merks wrote:
>> Paul,
>>
>> I recently changed this
>> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=190666) so that the
>> validation is no longer done during construction but rather as a
>> validation step later. I've noticed it's quite common to end up with a
>> "dateTime" type of result when only a "date" is expected...
>>
>>
>> Paul Gardiner wrote:
>>> Is it possible to use a GregorianCalendar or XMLGregorianCalendar or
>>> XMLCalendar using Teneo/Hibernate? Date seems to work fine, but I get
>>> exceptions such as :
>>>
>>> The value '2007-06-06T14:42:43Z' is
>>> invalid.">java.lang.IllegalArgumentException: The value
>>> '2007-06-06T14:42:43Z' is invalid. at
>>> org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:439)
>>> at . . .
>>>
>>> Whenever I try to use an XMLCalendar. I get something similar for the
>>> other types. I am setting the XMLTypePackages in my
>>> HbDataStore.setEPackages() method, which I think is correct.
>>>
>>>
>
>
> --
>
> 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: [teneo] XML(Gregorian)Calendar or GregorianCalendar [message #606889 is a reply to message #85798] Fri, 08 June 2007 12:35 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
I just use the Date class myself.
I think also gregorian calendar is supported by Hibernate, you can try.
If it does not work then you need to create your own hibernate usertype and set a @Type/@TypeDef
annotation on the edatatype/eattribute having this.

gr. Martin

Paul Gardiner wrote:
> Before I send a stack trace, what type should I be using for dates/times?
> My preference is GregorianCalendar, but I'm not sure if it's supported. Do
> I need to add any specific ePackage? Also, do I need a type attribute on my
> @model annotation?
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:f478et$d1h$1@build.eclipse.org...
>> Hi Paul,
>> I would need a longer stack trace to really comment on this. Teneo should
>> be able to support this.
>>
>> As an example from a testcase I have:
>> This xsd:
>> <complexType name="TestDate">
>> <sequence>
>> <element name="date" type="date"></element>
>> <element name="datetime" type="dateTime"></element>
>> </sequence>
>> </complexType>
>>
>> Results in this ecore:
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="date"
>> unique="false" lowerBound="1"
>> eType="ecore:EDataType
>> http://www.eclipse.org/emf/2003/XMLType#//Date">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="element"/>
>> <details key="name" value="date"/>
>> <details key="namespace" value="##targetNamespace"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="datetime"
>> unique="false"
>> lowerBound="1" eType="ecore:EDataType
>> http://www.eclipse.org/emf/2003/XMLType#//DateTime">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="element"/>
>> <details key="name" value="datetime"/>
>> <details key="namespace" value="##targetNamespace"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>>
>>
>> Which results in this hbm:
>>
>> <property name="date" lazy="false" insert="true" update="true"
>> not-null="true" unique="false"
>> type="org.eclipse.emf.teneo.hibernate.mapping.XSDDate">
>> <column not-null="true" unique="false" name="`date`"/>
>> </property>
>> <property name="datetime" lazy="false" insert="true" update="true"
>> not-null="true" unique="false"
>> type="org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime">
>> <column not-null="true" unique="false" name="`datetime`"/>
>> </property>
>>
>> gr. Martin
>>
>> Ed Merks wrote:
>>> Paul,
>>>
>>> I recently changed this
>>> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=190666) so that the
>>> validation is no longer done during construction but rather as a
>>> validation step later. I've noticed it's quite common to end up with a
>>> "dateTime" type of result when only a "date" is expected...
>>>
>>>
>>> Paul Gardiner wrote:
>>>> Is it possible to use a GregorianCalendar or XMLGregorianCalendar or
>>>> XMLCalendar using Teneo/Hibernate? Date seems to work fine, but I get
>>>> exceptions such as :
>>>>
>>>> The value '2007-06-06T14:42:43Z' is
>>>> invalid.">java.lang.IllegalArgumentException: The value
>>>> '2007-06-06T14:42:43Z' is invalid. at
>>>> org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:439)
>>>> at . . .
>>>>
>>>> Whenever I try to use an XMLCalendar. I get something similar for the
>>>> other types. I am setting the XMLTypePackages in my
>>>> HbDataStore.setEPackages() method, which I think is correct.
>>>>
>>>>
>>
>> --
>>
>> 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
>
>
I

--

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
[teneo] XMLGregorianCalendar [message #606893 is a reply to message #85825] Sat, 09 June 2007 08:17 Go to previous message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
Hello, I have a similar problem:
There is a type in ecore model :
<eClassifiers xsi:type="ecore:EDataType" name="DateCategoriesCust"
instanceClassName="javax.xml.datatype.XMLGregorianCalendar" >
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="?"?
Re: [teneo] XMLGregorianCalendar [message #606894 is a reply to message #85895] Sat, 09 June 2007 09:57 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040607090305070004080900
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Wolf,

This was a bug that we encountered earlier this week and should be fixed
in this weeks 2.3 build

https://bugs.eclipse.org/bugs/show_bug.cgi?id=191219

The problem only occurs on the Sun JDK and looks to be a bug in the JDK
where Sun's JDK doesn't implement .equals properly. It's never valid to
fail comparison with a cast cast exception. The equals implementation
of any subclass of XMLGregorianCalendard should be tolerant of any other
implementation of XMLGregorianCalendar rather than assume that only a
particular implementation is present. I'm not sure if there is a Sun
bug report about it...


wolf_roma wrote:
> Hello, I have a similar problem:
> There is a type in ecore model :
> <eClassifiers xsi:type="ecore:EDataType" name="DateCategoriesCust"
> instanceClassName="javax.xml.datatype.XMLGregorianCalendar" >
> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
> <details key="documentation" value="?"?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [teneo] XMLGregorianCalendar [message #606896 is a reply to message #85913] Sat, 09 June 2007 11:32 Go to previous message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_0017_01C7AAAB.55685960
Content-Type: text/plain;
charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

Thanks, well work!
------=_NextPart_000_0017_01C7AAAB.55685960
Content-Type: text/html;
charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.3086" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Thanks, well =
work!</FONT></DIV></BODY></HTML>

------=_NextPart_000_0017_01C7AAAB.55685960--
Previous Topic:[Teneo] Exception and Persistence mapping
Next Topic:[Teneo] Exception and Persistence mapping
Goto Forum:
  


Current Time: Fri Mar 29 15:35:17 GMT 2024

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

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

Back to the top