Community
Participate
Working Groups
My elements of type date and datetime are currently mapping to varchar(255) instead of date or datetime in the database. The following XSD element <element name="lastReboot" type="dateTime"></element> maps to the following hbm: <property name="lastReboot" lazy="false" insert="true" update="true" not-null="false" unique="false"> <column not-null="false" unique="false" name="`lastreboot`"/> <type name="org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserType"> <param name="edatatype">Date</param> <param name="epackage">http://www.eclipse.org/emf/2003/XMLType</param> </type> </property> The ecore mapping looks like: <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastReboot" unique="false" 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="lastReboot"/> <details key="namespace" value="##targetNamespace"/> </eAnnotations> </eStructuralFeatures> Although it looks like the DateTime type is preserved in the mapping, I noticed that the ecore-Java instanceClass for the eDataType is of type "Object". Teneo always maps this to a String. Underneath, EMF maintains the date through a class called org.eclipse.xsd.impl.type.XSDDateTimeType whose value is an instance of an internal XMLCalendar class. I've created a patch to Teneo's hibernate mapping to fix this. I have not done anything with the JPOX/JDO implementation but I suspect it could have similar issues.
Created attachment 60018 [details] Patch to the AbstractMapper class
Created attachment 60019 [details] Patch to the ECoreDataTypes class
Created attachment 60020 [details] Additional hibernate mapping classes for data and datetime these are new java classes that must go into the org.eclipse.emf.teneo.hibernate.mapping package.
Created attachment 60022 [details] A simple XSD that illustrates the problem When Teneo maps this XSD to the database, it results in a VARCHAR(255) in the database. With the patches installed, they end up being date and datetime.
I've included patch files that were generated from the R0_7_maintenance branch tag.
Added this in cvs (only for head, the 0.8.0 release). I have made minor changes here and there. This is only available in the 0.8.0 release. Let me know if this is really a big issue. Then I can add it to the 0.7.5 release. gr. Martin
Thanks for incorporating it. Unfortunately, I have to work off the Teneo maintenance branch (is the tag 0.7.5 or is it R0_7_maintenance?) since I can't make the jump to the next version (Europa) of Eclipse that is demanded by EMF 2.3 until later this year.
Okay, I'll also add it to 0.7.5. gr. Martin
Hi Brian, I have also applied the changes to the maintenance branch. gr. Martin
Has been committed to cvs for the maintenance branch. Will be in the next release. gr. Martin
I updated from the maintenance branch and it seems to be working well. Thanks.
Has been solved in builds M200703091332 and I200703081604.
Thanks for the contribution Brian! gr. Martin
Move to verified as per bug 206558.