|
Re: [teneo] XML(Gregorian)Calendar or GregorianCalendar [message #85638 is a reply to message #85609] |
Wed, 06 June 2007 16:54 |
Eclipse User |
|
|
|
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 #85798 is a reply to message #85678] |
Thu, 07 June 2007 14:28 |
Paul Gardiner 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 |
Martin Taal 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
|
|
|
|
Re: [teneo] XMLGregorianCalendar [message #85913 is a reply to message #85895] |
Sat, 09 June 2007 09:57 |
Eclipse User |
|
|
|
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] XML(Gregorian)Calendar or GregorianCalendar [message #606874 is a reply to message #85609] |
Wed, 06 June 2007 16:54 |
Ed Merks Messages: 33218 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 #606887 is a reply to message #85678] |
Thu, 07 June 2007 14:28 |
Paul Gardiner 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 |
Martin Taal 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
|
|
|
|
Re: [teneo] XMLGregorianCalendar [message #606894 is a reply to message #85895] |
Sat, 09 June 2007 09:57 |
Ed Merks Messages: 33218 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/
|
|
|
|
Powered by
FUDForum. Page generated in 0.05809 seconds