Community
Participate
Working Groups
Build Identifier: Build id: 20100917-0705 This line of code not only makes the default Date but also overrides any annotations for timestamp props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE, "DATE"); It should be the other way around, where the annotation over-rides the default. Here is the resultant stack trace 2011-02-0518:01:15.321 GMT+0000 21354 [main] ERROR org.mortbay.log - failed HibernateSessionRequestFilter org.hibernate.HibernateException: Wrong column type in DMANAGER.PUBLIC.cleansingexception for column timereported. Found: timestamp, expected: date at org.hibernate.mapping.Table.validateColumns(Table.java:284) at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1130) at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341) at org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSessionFactory(HbSessionDataStore.java:218) Reproducible: Always Steps to Reproduce: 1. Set the above property in your Hibernate utility class 2. Run your utlity class 3.
Hi David, I tried to reproduce this but I could not. Afaics it works fine. I set this property: props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE, "DATE"); and used the model below. What I can see is that the annotation is correctly copied from the simpletype to the EAttribute. Then in the SingleAttributeAnnotator there is this code: if (aAttribute.getTemporal() == null) { setTemporal(aAttribute, optionDefaultTemporal); } as the temporal is set (copied from the edatatype), it is not overwritten by the default property. If you have time can you debug in that part of the code? This is the test model I used: <xsd:complexType name="Test"> <xsd:sequence> <xsd:element name="name" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="teneo.jpa">@Id</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="dateOrTime" type="this:javaDateTime" /> <xsd:element name="dateOrTimes" type="this:javaDateTime" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> <xsd:simpleType name="javaDateTime" ecore:instanceClass="java.sql.Timestamp"> <xsd:annotation> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo> </xsd:annotation> <xsd:restriction base="xsd:dateTime"> </xsd:restriction> </xsd:simpleType>