Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALUE, &
[Teneo] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALUE, & [message #425174] Tue, 18 November 2008 09:44 Go to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

I have a set of columns that I need to be timestamps. So I use this

<xsd:simpleType name="javaDate" ecore:instanceClass="java.util.Date">
<xsd:restriction base="xsd:dateTime">
</xsd:restriction>
</xsd:simpleType>

<xsd:attribute name="snapTime" type="gensec:javaDate" >
<xsd:annotation>
<xsd:appinfo
source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>

The hibernate.hbm.xml shows this

<property name="snapTime" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`snaptime`"/>
</property>

But the schema generated creates Date columns, not Timestamp?

Thx.

David
Re: [Teneo] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALU [message #425176 is a reply to message #425174] Tue, 18 November 2008 09:58 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
For many cases the java.util.Date works fine (as it is detailed to the millis level).
If you want TimeStamp then you need to introduce a simpleType for timestamp with the specific
java.sql.TimeStamp instanceclass. You can also place the annotation in the timestamp simpletype,
then you don't need to repeat it every time in the xsd:

<xsd:simpleType name="javaTimeStamp" 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>

and then use this datatype (without annotation):
<xsd:attribute name="snapTime" type="gensec:javaTimeStamp"/>

gr. Martin

David Wynter wrote:
> Hi,
>
> I have a set of columns that I need to be timestamps. So I use this
>
> <xsd:simpleType name="javaDate" ecore:instanceClass="java.util.Date">
> <xsd:restriction base="xsd:dateTime">
> </xsd:restriction>
> </xsd:simpleType>
>
> <xsd:attribute name="snapTime" type="gensec:javaDate" >
> <xsd:annotation>
> <xsd:appinfo
> source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
> </xsd:annotation>
> </xsd:attribute>
>
> The hibernate.hbm.xml shows this
>
> <property name="snapTime" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`snaptime`"/>
> </property>
>
> But the schema generated creates Date columns, not Timestamp?
>
> Thx.
>
> David
>


--

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
[Teneo - Spring] No property 'ePackageClasses' found [message #425291 is a reply to message #425176] Fri, 21 November 2008 19:58 Go to previous messageGo to next message
Ole Ersoy is currently offline Ole ErsoyFriend
Messages: 205
Registered: July 2009
Senior Member
Hi,

I'm trying out Teneo with Spring. I noticed that using ePackageClasses to set the ePackages does not work, but if I change the property name to EPackageClasses it does.

Anyone know if this is a Spring bug? I looked at the method:

public void setEPackageClasses(java.util.List<String> ePackageClasses) {
if (ePackageConstructor == null) {
ePackageConstructor = new EPackageConstructor();
}
ePackageConstructor.setModelClasses(ePackageClasses);
}

It looks fine. I also tried a simpler mockup version of setting a property via setter injection, when the property is not present on the class, and it works.

Thoughts?

Thanks,
- Ole
Re: [Teneo - Spring] No property 'ePackageClasses' found [message #425363 is a reply to message #425291] Sat, 22 November 2008 16:27 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Ole,
No other thoughts then that I have noticed with Hibernate also a similar thing (as I remember it),
apparently the second upper-cased character (the P) gives confusion.

gr. Martin

Ole Ersoy wrote:
> Hi,
>
> I'm trying out Teneo with Spring. I noticed that using ePackageClasses
> to set the ePackages does not work, but if I change the property name to
> EPackageClasses it does.
>
> Anyone know if this is a Spring bug? I looked at the method:
>
> public void setEPackageClasses(java.util.List<String>
> ePackageClasses) {
> if (ePackageConstructor == null) {
> ePackageConstructor = new EPackageConstructor();
> }
> ePackageConstructor.setModelClasses(ePackageClasses);
> }
>
> It looks fine. I also tried a simpler mockup version of setting a
> property via setter injection, when the property is not present on the
> class, and it works.
>
> Thoughts?
>
> Thanks,
> - Ole


--

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 - Spring] No property 'ePackageClasses' found [message #425407 is a reply to message #425363] Tue, 25 November 2008 15:46 Go to previous messageGo to next message
Ole Ersoy is currently offline Ole ErsoyFriend
Messages: 205
Registered: July 2009
Senior Member
Hi Martin,

You're right. I tried it out with a simple setup like so:

METHOD
============================================================ ============
public void setMYList(List myList)
{
System.out.println("MY LIST IS: " + myList);
}
============================================================ ============

CONTEXT
============================================================ ============

<bean
id="mockSetterInjection"
class="mock.beans.MockSetterInjection">
<property
name="mYList">
<list>
<value>
org.example.impl.ExamplePackageImpl
</value>
</list>
</property>
</bean>
============================================================ ============

RESULT
============================================================ ============
When I load the above context, I also get:

Error creating bean with name 'mockSetterInjection' defined in file [src/test/resources/context2.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'mYList' of bean class [mock.beans.MockSetterInjection]: No property 'mYList' found
============================================================ ============

But if I change the name of the propety mYList to MYList, then the test runs fine.

Thanks,
- Ole
Re: [Teneo] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALU [message #652707 is a reply to message #425176] Sat, 05 February 2011 18:10 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi Martin,

Not sure what is happening here, as I followed your advice over 2years
ago and I seem to remember it working.

Using org.eclipse.emf.teneo.hibernate 1.1.1

I use

<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>

and

<xsd:complexType name="CleansingException">
<xsd:attribute name="id" type="xsd:int">
<xsd:annotation>
<xsd:appinfo source="teneo.jpa">@Id
@GeneratedValue(strategy=IDENTITY)</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="timeReported" type="datamanager:javaDateTime" />
</xsd:complexType>
<xsd:element name="cleansingException"
type="datamanager:CleansingException"/>

and yet I get the following after reloading genmodel, regenerating the
code and running my HibernateUtil.

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(SchemaVa lidator.java:139)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1341)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:218)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:93)
at
org.eclipse.emf.teneo.hibernate.HbBaseSessionDataStore.getSe ssionFactory(HbBaseSessionDataStore.java:74)
at com.example.something.HibernateUtil.init(HibernateUtil.java: 94)

I only need millisecond precision but it is not clear how you get a
timestamp column type from annotations, any examples? So I tried the
full timestamp route and it failed. Any ideas?

Thx,

David

On 18/11/08 09:58, Martin Taal wrote:
> Hi David,
> For many cases the java.util.Date works fine (as it is detailed to the
> millis level).
> If you want TimeStamp then you need to introduce a simpleType for
> timestamp with the specific java.sql.TimeStamp instanceclass. You can
> also place the annotation in the timestamp simpletype, then you don't
> need to repeat it every time in the xsd:
>
> <xsd:simpleType name="javaTimeStamp"
> 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>
>
> and then use this datatype (without annotation):
> <xsd:attribute name="snapTime" type="gensec:javaTimeStamp"/>
>
> gr. Martin
>
> David Wynter wrote:
>> Hi,
>>
>> I have a set of columns that I need to be timestamps. So I use this
>>
>> <xsd:simpleType name="javaDate" ecore:instanceClass="java.util.Date">
>> <xsd:restriction base="xsd:dateTime">
>> </xsd:restriction>
>> </xsd:simpleType>
>>
>> <xsd:attribute name="snapTime" type="gensec:javaDate" >
>> <xsd:annotation>
>> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
>> </xsd:annotation>
>> </xsd:attribute>
>>
>> The hibernate.hbm.xml shows this
>>
>> <property name="snapTime" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`snaptime`"/>
>> </property>
>>
>> But the schema generated creates Date columns, not Timestamp?
>>
>> Thx.
>>
>> David
>>
>
>
Re: [Teneo] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALU [message #652708 is a reply to message #652707] Sat, 05 February 2011 18:36 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
On 05/02/11 18:10, David Wynter wrote:
> Hi Martin,
>
> Not sure what is happening here, as I followed your advice over 2years
> ago and I seem to remember it working.
>
> Using org.eclipse.emf.teneo.hibernate 1.1.1
>
> I use
>
> <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>
>
> and
>
> <xsd:complexType name="CleansingException">
> <xsd:attribute name="id" type="xsd:int">
> <xsd:annotation>
> <xsd:appinfo source="teneo.jpa">@Id
> @GeneratedValue(strategy=IDENTITY)</xsd:appinfo>
> </xsd:annotation>
> </xsd:attribute>
> <xsd:attribute name="timeReported" type="datamanager:javaDateTime" />
> </xsd:complexType>
> <xsd:element name="cleansingException"
> type="datamanager:CleansingException"/>
>
> and yet I get the following after reloading genmodel, regenerating the
> code and running my HibernateUtil.
>
> 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(SchemaVa lidator.java:139)
>
> at
> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1341)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:218)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:93)
>
> at
> org.eclipse.emf.teneo.hibernate.HbBaseSessionDataStore.getSe ssionFactory(HbBaseSessionDataStore.java:74)
>
> at com.example.something.HibernateUtil.init(HibernateUtil.java: 94)
>
> I only need millisecond precision but it is not clear how you get a
> timestamp column type from annotations, any examples? So I tried the
> full timestamp route and it failed. Any ideas?
>
> Thx,
>
> David
>
> On 18/11/08 09:58, Martin Taal wrote:
>> Hi David,
>> For many cases the java.util.Date works fine (as it is detailed to the
>> millis level).
>> If you want TimeStamp then you need to introduce a simpleType for
>> timestamp with the specific java.sql.TimeStamp instanceclass. You can
>> also place the annotation in the timestamp simpletype, then you don't
>> need to repeat it every time in the xsd:
>>
>> <xsd:simpleType name="javaTimeStamp"
>> 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>
>>
>> and then use this datatype (without annotation):
>> <xsd:attribute name="snapTime" type="gensec:javaTimeStamp"/>
>>
>> gr. Martin
>>
>> David Wynter wrote:
>>> Hi,
>>>
>>> I have a set of columns that I need to be timestamps. So I use this
>>>
>>> <xsd:simpleType name="javaDate" ecore:instanceClass="java.util.Date">
>>> <xsd:restriction base="xsd:dateTime">
>>> </xsd:restriction>
>>> </xsd:simpleType>
>>>
>>> <xsd:attribute name="snapTime" type="gensec:javaDate" >
>>> <xsd:annotation>
>>> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
>>> </xsd:annotation>
>>> </xsd:attribute>
>>>
>>> The hibernate.hbm.xml shows this
>>>
>>> <property name="snapTime" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`snaptime`"/>
>>> </property>
>>>
>>> But the schema generated creates Date columns, not Timestamp?
>>>
>>> Thx.
>>>
>>> David
>>>
>>
>>
>
I also tried this

<xsd:attribute name="attemptDate" type="xsd:dateTime">
<xsd:annotation>
<xsd:appinfo
source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>

with the same results.

So am unable to use a millisecond precision.

David
Re: [Teneo] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALU [message #652749 is a reply to message #652708] Sun, 06 February 2011 09:48 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
How does the generated hbm look like? (datastore.getMappingXML())
You are not using a fixed hbm file are you (so the hbm is generated in-memory)?

gr. Martin

On 02/05/2011 07:36 PM, David Wynter wrote:
> On 05/02/11 18:10, David Wynter wrote:
>> Hi Martin,
>>
>> Not sure what is happening here, as I followed your advice over 2years
>> ago and I seem to remember it working.
>>
>> Using org.eclipse.emf.teneo.hibernate 1.1.1
>>
>> I use
>>
>> <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>
>>
>> and
>>
>> <xsd:complexType name="CleansingException">
>> <xsd:attribute name="id" type="xsd:int">
>> <xsd:annotation>
>> <xsd:appinfo source="teneo.jpa">@Id
>> @GeneratedValue(strategy=IDENTITY)</xsd:appinfo>
>> </xsd:annotation>
>> </xsd:attribute>
>> <xsd:attribute name="timeReported" type="datamanager:javaDateTime" />
>> </xsd:complexType>
>> <xsd:element name="cleansingException"
>> type="datamanager:CleansingException"/>
>>
>> and yet I get the following after reloading genmodel, regenerating the
>> code and running my HibernateUtil.
>>
>> 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(SchemaVa lidator.java:139)
>>
>> at
>> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359)
>> at
>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1341)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:218)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:93)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbBaseSessionDataStore.getSe ssionFactory(HbBaseSessionDataStore.java:74)
>>
>> at com.example.something.HibernateUtil.init(HibernateUtil.java: 94)
>>
>> I only need millisecond precision but it is not clear how you get a
>> timestamp column type from annotations, any examples? So I tried the
>> full timestamp route and it failed. Any ideas?
>>
>> Thx,
>>
>> David
>>
>> On 18/11/08 09:58, Martin Taal wrote:
>>> Hi David,
>>> For many cases the java.util.Date works fine (as it is detailed to the
>>> millis level).
>>> If you want TimeStamp then you need to introduce a simpleType for
>>> timestamp with the specific java.sql.TimeStamp instanceclass. You can
>>> also place the annotation in the timestamp simpletype, then you don't
>>> need to repeat it every time in the xsd:
>>>
>>> <xsd:simpleType name="javaTimeStamp"
>>> 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>
>>>
>>> and then use this datatype (without annotation):
>>> <xsd:attribute name="snapTime" type="gensec:javaTimeStamp"/>
>>>
>>> gr. Martin
>>>
>>> David Wynter wrote:
>>>> Hi,
>>>>
>>>> I have a set of columns that I need to be timestamps. So I use this
>>>>
>>>> <xsd:simpleType name="javaDate" ecore:instanceClass="java.util.Date">
>>>> <xsd:restriction base="xsd:dateTime">
>>>> </xsd:restriction>
>>>> </xsd:simpleType>
>>>>
>>>> <xsd:attribute name="snapTime" type="gensec:javaDate" >
>>>> <xsd:annotation>
>>>> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
>>>> </xsd:annotation>
>>>> </xsd:attribute>
>>>>
>>>> The hibernate.hbm.xml shows this
>>>>
>>>> <property name="snapTime" lazy="false" insert="true" update="true"
>>>> not-null="false" unique="false" type="timestamp">
>>>> <column not-null="false" unique="false" name="`snaptime`"/>
>>>> </property>
>>>>
>>>> But the schema generated creates Date columns, not Timestamp?
>>>>
>>>> Thx.
>>>>
>>>> David
>>>>
>>>
>>>
>>
> I also tried this
>
> <xsd:attribute name="attemptDate" type="xsd:dateTime">
> <xsd:annotation>
> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
> </xsd:annotation>
> </xsd:attribute>
>
> with the same results.
>
> So am unable to use a millisecond precision.
>
> David


--

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] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALU [message #652752 is a reply to message #652749] Sun, 06 February 2011 11:05 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

I thought I'd try the 1.2.0 version of Teneo before I got your reply. So
updated EMF to 2.6.0 and Teneo to 1.2.0, and the dependencies you
provide but when I try to add V1.2.0 as a dependent plugin, it does not
appear, V1.1.2 does. I have org.eclipse.emf.ecore selected as V2.6.0.
V1.2.0 of Teneo hibernate does appear in the installation dialog for
Eclipse 3.6.

What else do I need to do to update?

I'll downgrade back to EMF V2.5.0 and get the hbm detail.

Thx.

David
On 06/02/11 09:48, Martin Taal wrote:
> Hi David,
> How does the generated hbm look like? (datastore.getMappingXML())
> You are not using a fixed hbm file are you (so the hbm is generated
> in-memory)?
>
> gr. Martin
>
> On 02/05/2011 07:36 PM, David Wynter wrote:
>> On 05/02/11 18:10, David Wynter wrote:
>>> Hi Martin,
>>>
>>> Not sure what is happening here, as I followed your advice over 2years
>>> ago and I seem to remember it working.
>>>
>>> Using org.eclipse.emf.teneo.hibernate 1.1.1
>>>
>>> I use
>>>
>>> <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>
>>>
>>> and
>>>
>>> <xsd:complexType name="CleansingException">
>>> <xsd:attribute name="id" type="xsd:int">
>>> <xsd:annotation>
>>> <xsd:appinfo source="teneo.jpa">@Id
>>> @GeneratedValue(strategy=IDENTITY)</xsd:appinfo>
>>> </xsd:annotation>
>>> </xsd:attribute>
>>> <xsd:attribute name="timeReported" type="datamanager:javaDateTime" />
>>> </xsd:complexType>
>>> <xsd:element name="cleansingException"
>>> type="datamanager:CleansingException"/>
>>>
>>> and yet I get the following after reloading genmodel, regenerating the
>>> code and running my HibernateUtil.
>>>
>>> 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(SchemaVa lidator.java:139)
>>>
>>>
>>> at
>>> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359)
>>>
>>> at
>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1341)
>>>
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:218)
>>>
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:93)
>>>
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbBaseSessionDataStore.getSe ssionFactory(HbBaseSessionDataStore.java:74)
>>>
>>>
>>> at com.example.something.HibernateUtil.init(HibernateUtil.java: 94)
>>>
>>> I only need millisecond precision but it is not clear how you get a
>>> timestamp column type from annotations, any examples? So I tried the
>>> full timestamp route and it failed. Any ideas?
>>>
>>> Thx,
>>>
>>> David
>>>
>>> On 18/11/08 09:58, Martin Taal wrote:
>>>> Hi David,
>>>> For many cases the java.util.Date works fine (as it is detailed to the
>>>> millis level).
>>>> If you want TimeStamp then you need to introduce a simpleType for
>>>> timestamp with the specific java.sql.TimeStamp instanceclass. You can
>>>> also place the annotation in the timestamp simpletype, then you don't
>>>> need to repeat it every time in the xsd:
>>>>
>>>> <xsd:simpleType name="javaTimeStamp"
>>>> 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>
>>>>
>>>> and then use this datatype (without annotation):
>>>> <xsd:attribute name="snapTime" type="gensec:javaTimeStamp"/>
>>>>
>>>> gr. Martin
>>>>
>>>> David Wynter wrote:
>>>>> Hi,
>>>>>
>>>>> I have a set of columns that I need to be timestamps. So I use this
>>>>>
>>>>> <xsd:simpleType name="javaDate" ecore:instanceClass="java.util.Date">
>>>>> <xsd:restriction base="xsd:dateTime">
>>>>> </xsd:restriction>
>>>>> </xsd:simpleType>
>>>>>
>>>>> <xsd:attribute name="snapTime" type="gensec:javaDate" >
>>>>> <xsd:annotation>
>>>>> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
>>>>> </xsd:annotation>
>>>>> </xsd:attribute>
>>>>>
>>>>> The hibernate.hbm.xml shows this
>>>>>
>>>>> <property name="snapTime" lazy="false" insert="true" update="true"
>>>>> not-null="false" unique="false" type="timestamp">
>>>>> <column not-null="false" unique="false" name="`snaptime`"/>
>>>>> </property>
>>>>>
>>>>> But the schema generated creates Date columns, not Timestamp?
>>>>>
>>>>> Thx.
>>>>>
>>>>> David
>>>>>
>>>>
>>>>
>>>
>> I also tried this
>>
>> <xsd:attribute name="attemptDate" type="xsd:dateTime">
>> <xsd:annotation>
>> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
>> </xsd:annotation>
>> </xsd:attribute>
>>
>> with the same results.
>>
>> So am unable to use a millisecond precision.
>>
>> David
>
>
Re: [Teneo] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALU [message #652758 is a reply to message #652752] Sun, 06 February 2011 12:26 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Yes you can take v1.1.2 in this case.

gr. Martin

On 02/06/2011 12:05 PM, David Wynter wrote:
> Hi,
>
> I thought I'd try the 1.2.0 version of Teneo before I got your reply. So updated EMF to 2.6.0 and Teneo to 1.2.0, and
> the dependencies you provide but when I try to add V1.2.0 as a dependent plugin, it does not appear, V1.1.2 does. I have
> org.eclipse.emf.ecore selected as V2.6.0. V1.2.0 of Teneo hibernate does appear in the installation dialog for Eclipse 3.6.
>
> What else do I need to do to update?
>
> I'll downgrade back to EMF V2.5.0 and get the hbm detail.
>
> Thx.
>
> David
> On 06/02/11 09:48, Martin Taal wrote:
>> Hi David,
>> How does the generated hbm look like? (datastore.getMappingXML())
>> You are not using a fixed hbm file are you (so the hbm is generated
>> in-memory)?
>>
>> gr. Martin
>>
>> On 02/05/2011 07:36 PM, David Wynter wrote:
>>> On 05/02/11 18:10, David Wynter wrote:
>>>> Hi Martin,
>>>>
>>>> Not sure what is happening here, as I followed your advice over 2years
>>>> ago and I seem to remember it working.
>>>>
>>>> Using org.eclipse.emf.teneo.hibernate 1.1.1
>>>>
>>>> I use
>>>>
>>>> <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>
>>>>
>>>> and
>>>>
>>>> <xsd:complexType name="CleansingException">
>>>> <xsd:attribute name="id" type="xsd:int">
>>>> <xsd:annotation>
>>>> <xsd:appinfo source="teneo.jpa">@Id
>>>> @GeneratedValue(strategy=IDENTITY)</xsd:appinfo>
>>>> </xsd:annotation>
>>>> </xsd:attribute>
>>>> <xsd:attribute name="timeReported" type="datamanager:javaDateTime" />
>>>> </xsd:complexType>
>>>> <xsd:element name="cleansingException"
>>>> type="datamanager:CleansingException"/>
>>>>
>>>> and yet I get the following after reloading genmodel, regenerating the
>>>> code and running my HibernateUtil.
>>>>
>>>> 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(SchemaVa lidator.java:139)
>>>>
>>>>
>>>> at
>>>> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359)
>>>>
>>>> at
>>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1341)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:218)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:93)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbBaseSessionDataStore.getSe ssionFactory(HbBaseSessionDataStore.java:74)
>>>>
>>>>
>>>> at com.example.something.HibernateUtil.init(HibernateUtil.java: 94)
>>>>
>>>> I only need millisecond precision but it is not clear how you get a
>>>> timestamp column type from annotations, any examples? So I tried the
>>>> full timestamp route and it failed. Any ideas?
>>>>
>>>> Thx,
>>>>
>>>> David
>>>>
>>>> On 18/11/08 09:58, Martin Taal wrote:
>>>>> Hi David,
>>>>> For many cases the java.util.Date works fine (as it is detailed to the
>>>>> millis level).
>>>>> If you want TimeStamp then you need to introduce a simpleType for
>>>>> timestamp with the specific java.sql.TimeStamp instanceclass. You can
>>>>> also place the annotation in the timestamp simpletype, then you don't
>>>>> need to repeat it every time in the xsd:
>>>>>
>>>>> <xsd:simpleType name="javaTimeStamp"
>>>>> 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>
>>>>>
>>>>> and then use this datatype (without annotation):
>>>>> <xsd:attribute name="snapTime" type="gensec:javaTimeStamp"/>
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> David Wynter wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I have a set of columns that I need to be timestamps. So I use this
>>>>>>
>>>>>> <xsd:simpleType name="javaDate" ecore:instanceClass="java.util.Date">
>>>>>> <xsd:restriction base="xsd:dateTime">
>>>>>> </xsd:restriction>
>>>>>> </xsd:simpleType>
>>>>>>
>>>>>> <xsd:attribute name="snapTime" type="gensec:javaDate" >
>>>>>> <xsd:annotation>
>>>>>> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
>>>>>> </xsd:annotation>
>>>>>> </xsd:attribute>
>>>>>>
>>>>>> The hibernate.hbm.xml shows this
>>>>>>
>>>>>> <property name="snapTime" lazy="false" insert="true" update="true"
>>>>>> not-null="false" unique="false" type="timestamp">
>>>>>> <column not-null="false" unique="false" name="`snaptime`"/>
>>>>>> </property>
>>>>>>
>>>>>> But the schema generated creates Date columns, not Timestamp?
>>>>>>
>>>>>> Thx.
>>>>>>
>>>>>> David
>>>>>>
>>>>>
>>>>>
>>>>
>>> I also tried this
>>>
>>> <xsd:attribute name="attemptDate" type="xsd:dateTime">
>>> <xsd:annotation>
>>> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
>>> </xsd:annotation>
>>> </xsd:attribute>
>>>
>>> with the same results.
>>>
>>> So am unable to use a millisecond precision.
>>>
>>> David
>>
>>
>


--

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] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALU [message #652847 is a reply to message #652758] Mon, 07 February 2011 11:02 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Sadly, Eclipse delivers the usual DLL hell. I uninstalled EMF 2.6.0 and
it will not allow me to install EMF V2.5.0 due to other borken
dependencies now, several of them. I have learnt from experience it is
better to scrap this Eclipse install rather than spend days trying to
sort out the DLL hell that is Eclipse whenever you don't use a complete
installation.

I assume I could not see the Teneo V1.2.0 ias an available dependency
because some versioning in the plugin manifest is wrong?

David


On 06/02/11 12:26, Martin Taal wrote:
> Yes you can take v1.1.2 in this case.
>
> gr. Martin
>
> On 02/06/2011 12:05 PM, David Wynter wrote:
>> Hi,
>>
>> I thought I'd try the 1.2.0 version of Teneo before I got your reply.
>> So updated EMF to 2.6.0 and Teneo to 1.2.0, and
>> the dependencies you provide but when I try to add V1.2.0 as a
>> dependent plugin, it does not appear, V1.1.2 does. I have
>> org.eclipse.emf.ecore selected as V2.6.0. V1.2.0 of Teneo hibernate
>> does appear in the installation dialog for Eclipse 3.6.
>>
>> What else do I need to do to update?
>>
>> I'll downgrade back to EMF V2.5.0 and get the hbm detail.
>>
>> Thx.
>>
>> David
>> On 06/02/11 09:48, Martin Taal wrote:
>>> Hi David,
>>> How does the generated hbm look like? (datastore.getMappingXML())
>>> You are not using a fixed hbm file are you (so the hbm is generated
>>> in-memory)?
>>>
>>> gr. Martin
>>>
>>> On 02/05/2011 07:36 PM, David Wynter wrote:
>>>> On 05/02/11 18:10, David Wynter wrote:
>>>>> Hi Martin,
>>>>>
>>>>> Not sure what is happening here, as I followed your advice over 2years
>>>>> ago and I seem to remember it working.
>>>>>
>>>>> Using org.eclipse.emf.teneo.hibernate 1.1.1
>>>>>
>>>>> I use
>>>>>
>>>>> <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>
>>>>>
>>>>> and
>>>>>
>>>>> <xsd:complexType name="CleansingException">
>>>>> <xsd:attribute name="id" type="xsd:int">
>>>>> <xsd:annotation>
>>>>> <xsd:appinfo source="teneo.jpa">@Id
>>>>> @GeneratedValue(strategy=IDENTITY)</xsd:appinfo>
>>>>> </xsd:annotation>
>>>>> </xsd:attribute>
>>>>> <xsd:attribute name="timeReported" type="datamanager:javaDateTime" />
>>>>> </xsd:complexType>
>>>>> <xsd:element name="cleansingException"
>>>>> type="datamanager:CleansingException"/>
>>>>>
>>>>> and yet I get the following after reloading genmodel, regenerating the
>>>>> code and running my HibernateUtil.
>>>>>
>>>>> 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(SchemaVa lidator.java:139)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359)
>>>>>
>>>>>
>>>>> at
>>>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1341)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:218)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:93)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.HbBaseSessionDataStore.getSe ssionFactory(HbBaseSessionDataStore.java:74)
>>>>>
>>>>>
>>>>>
>>>>> at com.example.something.HibernateUtil.init(HibernateUtil.java: 94)
>>>>>
>>>>> I only need millisecond precision but it is not clear how you get a
>>>>> timestamp column type from annotations, any examples? So I tried the
>>>>> full timestamp route and it failed. Any ideas?
>>>>>
>>>>> Thx,
>>>>>
>>>>> David
>>>>>
>>>>> On 18/11/08 09:58, Martin Taal wrote:
>>>>>> Hi David,
>>>>>> For many cases the java.util.Date works fine (as it is detailed to
>>>>>> the
>>>>>> millis level).
>>>>>> If you want TimeStamp then you need to introduce a simpleType for
>>>>>> timestamp with the specific java.sql.TimeStamp instanceclass. You can
>>>>>> also place the annotation in the timestamp simpletype, then you don't
>>>>>> need to repeat it every time in the xsd:
>>>>>>
>>>>>> <xsd:simpleType name="javaTimeStamp"
>>>>>> 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>
>>>>>>
>>>>>> and then use this datatype (without annotation):
>>>>>> <xsd:attribute name="snapTime" type="gensec:javaTimeStamp"/>
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> David Wynter wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have a set of columns that I need to be timestamps. So I use this
>>>>>>>
>>>>>>> <xsd:simpleType name="javaDate"
>>>>>>> ecore:instanceClass="java.util.Date">
>>>>>>> <xsd:restriction base="xsd:dateTime">
>>>>>>> </xsd:restriction>
>>>>>>> </xsd:simpleType>
>>>>>>>
>>>>>>> <xsd:attribute name="snapTime" type="gensec:javaDate" >
>>>>>>> <xsd:annotation>
>>>>>>> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
>>>>>>> </xsd:annotation>
>>>>>>> </xsd:attribute>
>>>>>>>
>>>>>>> The hibernate.hbm.xml shows this
>>>>>>>
>>>>>>> <property name="snapTime" lazy="false" insert="true" update="true"
>>>>>>> not-null="false" unique="false" type="timestamp">
>>>>>>> <column not-null="false" unique="false" name="`snaptime`"/>
>>>>>>> </property>
>>>>>>>
>>>>>>> But the schema generated creates Date columns, not Timestamp?
>>>>>>>
>>>>>>> Thx.
>>>>>>>
>>>>>>> David
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>> I also tried this
>>>>
>>>> <xsd:attribute name="attemptDate" type="xsd:dateTime">
>>>> <xsd:annotation>
>>>> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
>>>> </xsd:annotation>
>>>> </xsd:attribute>
>>>>
>>>> with the same results.
>>>>
>>>> So am unable to use a millisecond precision.
>>>>
>>>> David
>>>
>>>
>>
>
>
Re: [Teneo] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALU [message #652849 is a reply to message #652847] Mon, 07 February 2011 11:15 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
It is different, the Teneo 1.2.0 version contains plugins at 1.1.2, that's all.

gr. Martin

On 02/07/2011 12:02 PM, David Wynter wrote:
> Sadly, Eclipse delivers the usual DLL hell. I uninstalled EMF 2.6.0 and it will not allow me to install EMF V2.5.0 due
> to other borken dependencies now, several of them. I have learnt from experience it is better to scrap this Eclipse
> install rather than spend days trying to sort out the DLL hell that is Eclipse whenever you don't use a complete
> installation.
>
> I assume I could not see the Teneo V1.2.0 ias an available dependency because some versioning in the plugin manifest is
> wrong?
>
> David
>
>
> On 06/02/11 12:26, Martin Taal wrote:
>> Yes you can take v1.1.2 in this case.
>>
>> gr. Martin
>>
>> On 02/06/2011 12:05 PM, David Wynter wrote:
>>> Hi,
>>>
>>> I thought I'd try the 1.2.0 version of Teneo before I got your reply.
>>> So updated EMF to 2.6.0 and Teneo to 1.2.0, and
>>> the dependencies you provide but when I try to add V1.2.0 as a
>>> dependent plugin, it does not appear, V1.1.2 does. I have
>>> org.eclipse.emf.ecore selected as V2.6.0. V1.2.0 of Teneo hibernate
>>> does appear in the installation dialog for Eclipse 3.6.
>>>
>>> What else do I need to do to update?
>>>
>>> I'll downgrade back to EMF V2.5.0 and get the hbm detail.
>>>
>>> Thx.
>>>
>>> David
>>> On 06/02/11 09:48, Martin Taal wrote:
>>>> Hi David,
>>>> How does the generated hbm look like? (datastore.getMappingXML())
>>>> You are not using a fixed hbm file are you (so the hbm is generated
>>>> in-memory)?
>>>>
>>>> gr. Martin
>>>>
>>>> On 02/05/2011 07:36 PM, David Wynter wrote:
>>>>> On 05/02/11 18:10, David Wynter wrote:
>>>>>> Hi Martin,
>>>>>>
>>>>>> Not sure what is happening here, as I followed your advice over 2years
>>>>>> ago and I seem to remember it working.
>>>>>>
>>>>>> Using org.eclipse.emf.teneo.hibernate 1.1.1
>>>>>>
>>>>>> I use
>>>>>>
>>>>>> <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>
>>>>>>
>>>>>> and
>>>>>>
>>>>>> <xsd:complexType name="CleansingException">
>>>>>> <xsd:attribute name="id" type="xsd:int">
>>>>>> <xsd:annotation>
>>>>>> <xsd:appinfo source="teneo.jpa">@Id
>>>>>> @GeneratedValue(strategy=IDENTITY)</xsd:appinfo>
>>>>>> </xsd:annotation>
>>>>>> </xsd:attribute>
>>>>>> <xsd:attribute name="timeReported" type="datamanager:javaDateTime" />
>>>>>> </xsd:complexType>
>>>>>> <xsd:element name="cleansingException"
>>>>>> type="datamanager:CleansingException"/>
>>>>>>
>>>>>> and yet I get the following after reloading genmodel, regenerating the
>>>>>> code and running my HibernateUtil.
>>>>>>
>>>>>> 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(SchemaVa lidator.java:139)
>>>>>>
>>>>>>
>>>>>>
>>>>>> at
>>>>>> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359)
>>>>>>
>>>>>>
>>>>>> at
>>>>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1341)
>>>>>>
>>>>>>
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:218)
>>>>>>
>>>>>>
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:93)
>>>>>>
>>>>>>
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.HbBaseSessionDataStore.getSe ssionFactory(HbBaseSessionDataStore.java:74)
>>>>>>
>>>>>>
>>>>>>
>>>>>> at com.example.something.HibernateUtil.init(HibernateUtil.java: 94)
>>>>>>
>>>>>> I only need millisecond precision but it is not clear how you get a
>>>>>> timestamp column type from annotations, any examples? So I tried the
>>>>>> full timestamp route and it failed. Any ideas?
>>>>>>
>>>>>> Thx,
>>>>>>
>>>>>> David
>>>>>>
>>>>>> On 18/11/08 09:58, Martin Taal wrote:
>>>>>>> Hi David,
>>>>>>> For many cases the java.util.Date works fine (as it is detailed to
>>>>>>> the
>>>>>>> millis level).
>>>>>>> If you want TimeStamp then you need to introduce a simpleType for
>>>>>>> timestamp with the specific java.sql.TimeStamp instanceclass. You can
>>>>>>> also place the annotation in the timestamp simpletype, then you don't
>>>>>>> need to repeat it every time in the xsd:
>>>>>>>
>>>>>>> <xsd:simpleType name="javaTimeStamp"
>>>>>>> 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>
>>>>>>>
>>>>>>> and then use this datatype (without annotation):
>>>>>>> <xsd:attribute name="snapTime" type="gensec:javaTimeStamp"/>
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> David Wynter wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I have a set of columns that I need to be timestamps. So I use this
>>>>>>>>
>>>>>>>> <xsd:simpleType name="javaDate"
>>>>>>>> ecore:instanceClass="java.util.Date">
>>>>>>>> <xsd:restriction base="xsd:dateTime">
>>>>>>>> </xsd:restriction>
>>>>>>>> </xsd:simpleType>
>>>>>>>>
>>>>>>>> <xsd:attribute name="snapTime" type="gensec:javaDate" >
>>>>>>>> <xsd:annotation>
>>>>>>>> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
>>>>>>>> </xsd:annotation>
>>>>>>>> </xsd:attribute>
>>>>>>>>
>>>>>>>> The hibernate.hbm.xml shows this
>>>>>>>>
>>>>>>>> <property name="snapTime" lazy="false" insert="true" update="true"
>>>>>>>> not-null="false" unique="false" type="timestamp">
>>>>>>>> <column not-null="false" unique="false" name="`snaptime`"/>
>>>>>>>> </property>
>>>>>>>>
>>>>>>>> But the schema generated creates Date columns, not Timestamp?
>>>>>>>>
>>>>>>>> Thx.
>>>>>>>>
>>>>>>>> David
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>> I also tried this
>>>>>
>>>>> <xsd:attribute name="attemptDate" type="xsd:dateTime">
>>>>> <xsd:annotation>
>>>>> <xsd:appinfo source="teneo.jpa">@Temporal(TIMESTAMP)</xsd:appinfo>
>>>>> </xsd:annotation>
>>>>> </xsd:attribute>
>>>>>
>>>>> with the same results.
>>>>>
>>>>> So am unable to use a millisecond precision.
>>>>>
>>>>> David
>>>>
>>>>
>>>
>>
>>
>


--

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] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALU [message #652862 is a reply to message #652849] Mon, 07 February 2011 12:34 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Ok, Finally got there with V1.2.0 (or V1.1.2?)

To have it all in one place, here is the annotation in the XSD

<xsd:attribute name="attemptDate" type="xsd:dateTime">
<xsd:annotation>
<xsd:appinfo
source="teneo.jpa">@TemporalType(TIMESTAMP)</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>

Here is the mapping, which show type="date" for the above


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping auto-import="false">
<class name="com.example.application.impl.ChangeAttemptImpl"
entity-name="ChangeAttempt" abstract="false" lazy="false"
table="`changeattempt`">
<meta attribute="eclassName" inherit="false">ChangeAttempt</meta>
<meta attribute="epackage"
inherit="false">http://www.example.com/application</meta>
<id name="id" type="int" unsaved-value="0">
<column not-null="true" unique="false" name="`id`"/>
<generator class="identity"/>
</id>
<property name="attemptDate" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="date">
<column not-null="false" unique="false" name="`attemptdate`"/>
</property>
<property name="changeSource" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`changesource`"/>
</property>
<property name="changeValue" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`changevalue`"/>
</property>
<many-to-one name="userProtectedValues"
entity-name="UserProtectedValues" lazy="false"
cascade="merge,persist,save-update,lock,refresh"
foreign-key="chngeattempt_serprtectedvles" insert="true" update="true"
not-null="false">
<column not-null="false" unique="false" name="`userprotectedvalues`"/>
</many-to-one>
</class>
<class name="com.example.application.impl.CleansingExceptionImpl"
entity-name="CleansingException" abstract="false" lazy="false"
table="`cleansingexception`">
<meta attribute="eclassName" inherit="false">CleansingException</meta>
<meta attribute="epackage"
inherit="false">http://www.example.com/application</meta>
<id name="id" type="int" unsaved-value="0">
<column not-null="true" unique="false" name="`id`"/>
<generator class="identity"/>
</id>
<bag name="exceptionValue" lazy="true" cascade="all,delete-orphan">
<key update="true" foreign-key="clensingexceptin_exceptinvle">
<column name="`exceptionid`" not-null="false" unique="false"/>
</key>
<one-to-many entity-name="ExceptionValue"/>
</bag>
<property name="description" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`description`"/>
</property>
<property name="destFieldId" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="int">
<column not-null="false" unique="false" name="`destfieldid`"/>
</property>
<property name="endDate" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="date">
<column not-null="false" unique="false" name="`enddate`"/>
</property>
<property name="name" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`name`"/>
</property>
<property name="ownerId" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="int">
<column not-null="false" unique="false" name="`ownerid`"/>
</property>
<property name="timeReported" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="date">
<column not-null="false" unique="false" name="`timereported`"/>
</property>
<many-to-one name="exceptionType" entity-name="ExceptionType"
lazy="false" cascade="merge,persist,save-update,lock,refresh"
foreign-key="clnsingexceptin_exceptintype" insert="true" update="true"
not-null="false">
<column not-null="false" unique="false" name="`exceptiontype`"/>
</many-to-one>
</class>
<class name="com.example.application.impl.ExceptionTypeImpl"
entity-name="ExceptionType" abstract="false" lazy="false"
table="`exceptiontype`">
<meta attribute="eclassName" inherit="false">ExceptionType</meta>
<meta attribute="epackage"
inherit="false">http://www.example.com/application</meta>
<id name="id" type="int" unsaved-value="0">
<column not-null="true" unique="false" name="`id`"/>
<generator class="identity"/>
</id>
<bag name="cleansingException" lazy="true" cascade="all,delete-orphan">
<key update="true" foreign-key="excptintype_clensingexceptin">
<column name="`typeid`" not-null="false" unique="false"/>
</key>
<one-to-many entity-name="CleansingException"/>
</bag>
<property name="description" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`description`"/>
</property>
<property name="name" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`name`"/>
</property>
<property name="typeOwnerId" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="int">
<column not-null="false" unique="false" name="`typeownerid`"/>
</property>
<property name="validFrom" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="date">
<column not-null="false" unique="false" name="`validfrom`"/>
</property>
<property name="validTo" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="date">
<column not-null="false" unique="false" name="`validto`"/>
</property>
</class>
<class name="com.example.application.impl.ExceptionValueImpl"
entity-name="ExceptionValue" abstract="false" lazy="false"
table="`exceptionvalue`">
<meta attribute="eclassName" inherit="false">ExceptionValue</meta>
<meta attribute="epackage"
inherit="false">http://www.example.com/application</meta>
<id name="id" type="int" unsaved-value="0">
<column not-null="true" unique="false" name="`id`"/>
<generator class="identity"/>
</id>
<bag name="userProtectedValues" lazy="true" cascade="all,delete-orphan">
<key update="true" foreign-key="exceptinvle_serprtectedvales">
<column name="`exceptionvalue`" not-null="false" unique="false"/>
</key>
<one-to-many entity-name="UserProtectedValues"/>
</bag>
<property name="partOfPK" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="boolean">
<column not-null="false" unique="false" name="`partofpk`"/>
</property>
<property name="replacementValue" lazy="false" insert="true"
update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`replacementvalue`"/>
</property>
<property name="sourceFieldId" lazy="false" insert="true"
update="true" not-null="false" unique="false" type="int">
<column not-null="false" unique="false" name="`sourcefieldid`"/>
</property>
<property name="sourceTag" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`sourcetag`"/>
</property>
<property name="sourceValue" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`sourcevalue`"/>
</property>
<property name="timeRepaired" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="date">
<column not-null="false" unique="false" name="`timerepaired`"/>
</property>
<many-to-one name="cleansingException"
entity-name="CleansingException" lazy="false"
cascade="merge,persist,save-update,lock,refresh"
foreign-key="exceptinvle_clensingexceptin" insert="true" update="true"
not-null="false">
<column not-null="false" unique="false" name="`cleansingexception`"/>
</many-to-one>
</class>
<class name="com.example.application.impl.UserProtectedValuesImpl"
entity-name="UserProtectedValues" abstract="false" lazy="false"
table="`userprotectedvalues`">
<meta attribute="eclassName" inherit="false">UserProtectedValues</meta>
<meta attribute="epackage"
inherit="false">http://www.example.com/application</meta>
<id name="id" type="int" unsaved-value="0">
<column not-null="true" unique="false" name="`id`"/>
</id>
<bag name="changeAttempt" lazy="true" cascade="all,delete-orphan">
<key update="true" foreign-key="userprtectedvles_chngettempt">
<column name="`userprotectedvalues`" not-null="false" unique="false"/>
</key>
<one-to-many entity-name="ChangeAttempt"/>
</bag>
<property name="columnName" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`columnname`"/>
</property>
<property name="correctionValue" lazy="false" insert="true"
update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`correctionvalue`"/>
</property>
<property name="ownerId" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="int">
<column not-null="false" unique="false" name="`ownerid`"/>
</property>
<property name="pkCol1Name" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`pkcol1name`"/>
</property>
<property name="pkCol1Value" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`pkcol1value`"/>
</property>
<property name="pkCol2Name" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`pkcol2name`"/>
</property>
<property name="pkCol2Value" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`pkcol2value`"/>
</property>
<property name="pkCol3Name" la...

Thx.

David
Re: [Teneo] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALU [message #652889 is a reply to message #652862] Mon, 07 February 2011 13:17 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Found the problem. This line of code not only makes the default Date but
also overrides any annotations for timestamp

props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE,
"DATE");

I thought it would be the other way around, that the annotation
over-rode the default.

Thx.

David


On 07/02/11 12:34, David Wynter wrote:
> Ok, Finally got there with V1.2.0 (or V1.1.2?)
>
> To have it all in one place, here is the annotation in the XSD
>
> <xsd:attribute name="attemptDate" type="xsd:dateTime">
> <xsd:annotation>
> <xsd:appinfo source="teneo.jpa">@TemporalType(TIMESTAMP)</xsd:appinfo>
> </xsd:annotation>
> </xsd:attribute>
>
> Here is the mapping, which show type="date" for the above
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
> 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
>
> <hibernate-mapping auto-import="false">
> <class name="com.example.application.impl.ChangeAttemptImpl"
> entity-name="ChangeAttempt" abstract="false" lazy="false"
> table="`changeattempt`">
> <meta attribute="eclassName" inherit="false">ChangeAttempt</meta>
> <meta attribute="epackage"
> inherit="false">http://www.example.com/application</meta>
> <id name="id" type="int" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="identity"/>
> </id>
> <property name="attemptDate" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="date">
> <column not-null="false" unique="false" name="`attemptdate`"/>
> </property>
> <property name="changeSource" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`changesource`"/>
> </property>
> <property name="changeValue" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`changevalue`"/>
> </property>
> <many-to-one name="userProtectedValues"
> entity-name="UserProtectedValues" lazy="false"
> cascade="merge,persist,save-update,lock,refresh"
> foreign-key="chngeattempt_serprtectedvles" insert="true" update="true"
> not-null="false">
> <column not-null="false" unique="false" name="`userprotectedvalues`"/>
> </many-to-one>
> </class>
> <class name="com.example.application.impl.CleansingExceptionImpl"
> entity-name="CleansingException" abstract="false" lazy="false"
> table="`cleansingexception`">
> <meta attribute="eclassName" inherit="false">CleansingException</meta>
> <meta attribute="epackage"
> inherit="false">http://www.example.com/application</meta>
> <id name="id" type="int" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="identity"/>
> </id>
> <bag name="exceptionValue" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="clensingexceptin_exceptinvle">
> <column name="`exceptionid`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="ExceptionValue"/>
> </bag>
> <property name="description" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`description`"/>
> </property>
> <property name="destFieldId" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`destfieldid`"/>
> </property>
> <property name="endDate" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="date">
> <column not-null="false" unique="false" name="`enddate`"/>
> </property>
> <property name="name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <property name="ownerId" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`ownerid`"/>
> </property>
> <property name="timeReported" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="date">
> <column not-null="false" unique="false" name="`timereported`"/>
> </property>
> <many-to-one name="exceptionType" entity-name="ExceptionType"
> lazy="false" cascade="merge,persist,save-update,lock,refresh"
> foreign-key="clnsingexceptin_exceptintype" insert="true" update="true"
> not-null="false">
> <column not-null="false" unique="false" name="`exceptiontype`"/>
> </many-to-one>
> </class>
> <class name="com.example.application.impl.ExceptionTypeImpl"
> entity-name="ExceptionType" abstract="false" lazy="false"
> table="`exceptiontype`">
> <meta attribute="eclassName" inherit="false">ExceptionType</meta>
> <meta attribute="epackage"
> inherit="false">http://www.example.com/application</meta>
> <id name="id" type="int" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="identity"/>
> </id>
> <bag name="cleansingException" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="excptintype_clensingexceptin">
> <column name="`typeid`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="CleansingException"/>
> </bag>
> <property name="description" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`description`"/>
> </property>
> <property name="name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <property name="typeOwnerId" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`typeownerid`"/>
> </property>
> <property name="validFrom" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="date">
> <column not-null="false" unique="false" name="`validfrom`"/>
> </property>
> <property name="validTo" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="date">
> <column not-null="false" unique="false" name="`validto`"/>
> </property>
> </class>
> <class name="com.example.application.impl.ExceptionValueImpl"
> entity-name="ExceptionValue" abstract="false" lazy="false"
> table="`exceptionvalue`">
> <meta attribute="eclassName" inherit="false">ExceptionValue</meta>
> <meta attribute="epackage"
> inherit="false">http://www.example.com/application</meta>
> <id name="id" type="int" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="identity"/>
> </id>
> <bag name="userProtectedValues" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="exceptinvle_serprtectedvales">
> <column name="`exceptionvalue`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="UserProtectedValues"/>
> </bag>
> <property name="partOfPK" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`partofpk`"/>
> </property>
> <property name="replacementValue" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`replacementvalue`"/>
> </property>
> <property name="sourceFieldId" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`sourcefieldid`"/>
> </property>
> <property name="sourceTag" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`sourcetag`"/>
> </property>
> <property name="sourceValue" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`sourcevalue`"/>
> </property>
> <property name="timeRepaired" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="date">
> <column not-null="false" unique="false" name="`timerepaired`"/>
> </property>
> <many-to-one name="cleansingException" entity-name="CleansingException"
> lazy="false" cascade="merge,persist,save-update,lock,refresh"
> foreign-key="exceptinvle_clensingexceptin" insert="true" update="true"
> not-null="false">
> <column not-null="false" unique="false" name="`cleansingexception`"/>
> </many-to-one>
> </class>
> <class name="com.example.application.impl.UserProtectedValuesImpl"
> entity-name="UserProtectedValues" abstract="false" lazy="false"
> table="`userprotectedvalues`">
> <meta attribute="eclassName" inherit="false">UserProtectedValues</meta>
> <meta attribute="epackage"
> inherit="false">http://www.example.com/application</meta>
> <id name="id" type="int" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> </id>
> <bag name="changeAttempt" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="userprtectedvles_chngettempt">
> <column name="`userprotectedvalues`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="ChangeAttempt"/>
> </bag>
> <property name="columnName" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`columnname`"/>
> </property>
> <property name="correctionValue" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`correctionvalue`"/>
> </property>
> <property name="ownerId" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`ownerid`"/>
> </property>
> <property name="pkCol1Name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`pkcol1name`"/>
> </property>
> <property name="pkCol1Value" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`pkcol1value`"/>
> </property>
> <property name="pkCol2Name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`pkcol2name`"/>
> </property>
> <property name="pkCol2Value" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`pkcol2value`"/>
> </property>
> <property name="pkCol3Name" la...
>
> Thx.
>
> David
Re: [Teneo] Forcing a Timestamp data type for a column when PersistenceOptions.DEFAULT_TEMPORAL_VALU [message #652901 is a reply to message #652889] Mon, 07 February 2011 13:23 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
Indeed incorrect... Can you enter a bugzilla for this?

gr. Martin

On 02/07/2011 02:17 PM, David Wynter wrote:
> Found the problem. This line of code not only makes the default Date but also overrides any annotations for timestamp
>
> props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE, "DATE");
>
> I thought it would be the other way around, that the annotation over-rode the default.
>
> Thx.
>
> David
>
>
> On 07/02/11 12:34, David Wynter wrote:
>> Ok, Finally got there with V1.2.0 (or V1.1.2?)
>>
>> To have it all in one place, here is the annotation in the XSD
>>
>> <xsd:attribute name="attemptDate" type="xsd:dateTime">
>> <xsd:annotation>
>> <xsd:appinfo source="teneo.jpa">@TemporalType(TIMESTAMP)</xsd:appinfo>
>> </xsd:annotation>
>> </xsd:attribute>
>>
>> Here is the mapping, which show type="date" for the above
>>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
>> 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
>>
>> <hibernate-mapping auto-import="false">
>> <class name="com.example.application.impl.ChangeAttemptImpl"
>> entity-name="ChangeAttempt" abstract="false" lazy="false"
>> table="`changeattempt`">
>> <meta attribute="eclassName" inherit="false">ChangeAttempt</meta>
>> <meta attribute="epackage"
>> inherit="false">http://www.example.com/application</meta>
>> <id name="id" type="int" unsaved-value="0">
>> <column not-null="true" unique="false" name="`id`"/>
>> <generator class="identity"/>
>> </id>
>> <property name="attemptDate" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="date">
>> <column not-null="false" unique="false" name="`attemptdate`"/>
>> </property>
>> <property name="changeSource" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`changesource`"/>
>> </property>
>> <property name="changeValue" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`changevalue`"/>
>> </property>
>> <many-to-one name="userProtectedValues"
>> entity-name="UserProtectedValues" lazy="false"
>> cascade="merge,persist,save-update,lock,refresh"
>> foreign-key="chngeattempt_serprtectedvles" insert="true" update="true"
>> not-null="false">
>> <column not-null="false" unique="false" name="`userprotectedvalues`"/>
>> </many-to-one>
>> </class>
>> <class name="com.example.application.impl.CleansingExceptionImpl"
>> entity-name="CleansingException" abstract="false" lazy="false"
>> table="`cleansingexception`">
>> <meta attribute="eclassName" inherit="false">CleansingException</meta>
>> <meta attribute="epackage"
>> inherit="false">http://www.example.com/application</meta>
>> <id name="id" type="int" unsaved-value="0">
>> <column not-null="true" unique="false" name="`id`"/>
>> <generator class="identity"/>
>> </id>
>> <bag name="exceptionValue" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="clensingexceptin_exceptinvle">
>> <column name="`exceptionid`" not-null="false" unique="false"/>
>> </key>
>> <one-to-many entity-name="ExceptionValue"/>
>> </bag>
>> <property name="description" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`description`"/>
>> </property>
>> <property name="destFieldId" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="int">
>> <column not-null="false" unique="false" name="`destfieldid`"/>
>> </property>
>> <property name="endDate" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="date">
>> <column not-null="false" unique="false" name="`enddate`"/>
>> </property>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`name`"/>
>> </property>
>> <property name="ownerId" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="int">
>> <column not-null="false" unique="false" name="`ownerid`"/>
>> </property>
>> <property name="timeReported" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="date">
>> <column not-null="false" unique="false" name="`timereported`"/>
>> </property>
>> <many-to-one name="exceptionType" entity-name="ExceptionType"
>> lazy="false" cascade="merge,persist,save-update,lock,refresh"
>> foreign-key="clnsingexceptin_exceptintype" insert="true" update="true"
>> not-null="false">
>> <column not-null="false" unique="false" name="`exceptiontype`"/>
>> </many-to-one>
>> </class>
>> <class name="com.example.application.impl.ExceptionTypeImpl"
>> entity-name="ExceptionType" abstract="false" lazy="false"
>> table="`exceptiontype`">
>> <meta attribute="eclassName" inherit="false">ExceptionType</meta>
>> <meta attribute="epackage"
>> inherit="false">http://www.example.com/application</meta>
>> <id name="id" type="int" unsaved-value="0">
>> <column not-null="true" unique="false" name="`id`"/>
>> <generator class="identity"/>
>> </id>
>> <bag name="cleansingException" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="excptintype_clensingexceptin">
>> <column name="`typeid`" not-null="false" unique="false"/>
>> </key>
>> <one-to-many entity-name="CleansingException"/>
>> </bag>
>> <property name="description" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`description`"/>
>> </property>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`name`"/>
>> </property>
>> <property name="typeOwnerId" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="int">
>> <column not-null="false" unique="false" name="`typeownerid`"/>
>> </property>
>> <property name="validFrom" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="date">
>> <column not-null="false" unique="false" name="`validfrom`"/>
>> </property>
>> <property name="validTo" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="date">
>> <column not-null="false" unique="false" name="`validto`"/>
>> </property>
>> </class>
>> <class name="com.example.application.impl.ExceptionValueImpl"
>> entity-name="ExceptionValue" abstract="false" lazy="false"
>> table="`exceptionvalue`">
>> <meta attribute="eclassName" inherit="false">ExceptionValue</meta>
>> <meta attribute="epackage"
>> inherit="false">http://www.example.com/application</meta>
>> <id name="id" type="int" unsaved-value="0">
>> <column not-null="true" unique="false" name="`id`"/>
>> <generator class="identity"/>
>> </id>
>> <bag name="userProtectedValues" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="exceptinvle_serprtectedvales">
>> <column name="`exceptionvalue`" not-null="false" unique="false"/>
>> </key>
>> <one-to-many entity-name="UserProtectedValues"/>
>> </bag>
>> <property name="partOfPK" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="boolean">
>> <column not-null="false" unique="false" name="`partofpk`"/>
>> </property>
>> <property name="replacementValue" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`replacementvalue`"/>
>> </property>
>> <property name="sourceFieldId" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="int">
>> <column not-null="false" unique="false" name="`sourcefieldid`"/>
>> </property>
>> <property name="sourceTag" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`sourcetag`"/>
>> </property>
>> <property name="sourceValue" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`sourcevalue`"/>
>> </property>
>> <property name="timeRepaired" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="date">
>> <column not-null="false" unique="false" name="`timerepaired`"/>
>> </property>
>> <many-to-one name="cleansingException" entity-name="CleansingException"
>> lazy="false" cascade="merge,persist,save-update,lock,refresh"
>> foreign-key="exceptinvle_clensingexceptin" insert="true" update="true"
>> not-null="false">
>> <column not-null="false" unique="false" name="`cleansingexception`"/>
>> </many-to-one>
>> </class>
>> <class name="com.example.application.impl.UserProtectedValuesImpl"
>> entity-name="UserProtectedValues" abstract="false" lazy="false"
>> table="`userprotectedvalues`">
>> <meta attribute="eclassName" inherit="false">UserProtectedValues</meta>
>> <meta attribute="epackage"
>> inherit="false">http://www.example.com/application</meta>
>> <id name="id" type="int" unsaved-value="0">
>> <column not-null="true" unique="false" name="`id`"/>
>> </id>
>> <bag name="changeAttempt" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="userprtectedvles_chngettempt">
>> <column name="`userprotectedvalues`" not-null="false" unique="false"/>
>> </key>
>> <one-to-many entity-name="ChangeAttempt"/>
>> </bag>
>> <property name="columnName" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`columnname`"/>
>> </property>
>> <property name="correctionValue" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`correctionvalue`"/>
>> </property>
>> <property name="ownerId" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="int">
>> <column not-null="false" unique="false" name="`ownerid`"/>
>> </property>
>> <property name="pkCol1Name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`pkcol1name`"/>
>> </property>
>> <property name="pkCol1Value" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`pkcol1value`"/>
>> </property>
>> <property name="pkCol2Name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`pkcol2name`"/>
>> </property>
>> <property name="pkCol2Value" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`pkcol2value`"/>
>> </property>
>> <property name="pkCol3Name" la...
>>
>> Thx.
>>
>> David
>


--

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
Previous Topic:extend Ecore-Editor
Next Topic:[Teneo] HbDataStore - several schemas
Goto Forum:
  


Current Time: Fri Mar 29 06:16:12 GMT 2024

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

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

Back to the top