-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: date no auto generated when speficy in mapping.
PostPosted: Thu Jun 05, 2008 6:55 am 
Beginner
Beginner

Joined: Mon Dec 17, 2007 11:08 pm
Posts: 47
hi,

i had declared a element in my hbm.xml to generate, however, when insert and update is execute. I cannot see any date value but null instead.

my elements is same almost same like the one in hibernate in action.

<property name="lastModified"
update="false"
insert="false"
generated="always"/>

it will generated Datetime Type for MYSQL. but when i change to timestamp, it work like what i though (every insert and update is generated the date value).

am my mapping is incorrect ?

i receive this error

2008-06-05 18:44:14,942 WARN [org.hibernate.util.JDBCExceptionReporter] - <SQL Error: 1364, SQLState: HY000>
2008-06-05 18:44:14,942 ERROR [org.hibernate.util.JDBCExceptionReporter] - <Field 'lastModified' doesn't have a default value>
org.hibernate.exception.GenericJDBCException: could not insert: [com.XXX.ClassName]
....... //other exception


any idea ? all i want to do is declared a field that auto generated date.

kiwi
----
happy hacking

_________________
happy hacking !


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 7:08 am 
Regular
Regular

Joined: Wed Apr 09, 2008 10:28 am
Posts: 52
yes i think you have to add type="timestamp" that it works.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 12:12 pm 
Beginner
Beginner

Joined: Mon Dec 17, 2007 11:08 pm
Posts: 47
i had try. but it is not work.

anyway, i have use <timestamp /> instead of use in property.

kiwi

_________________
happy hacking !


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.