[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-749) Generated Annotation can not generate Date automatically
yuanqingfei (JIRA)
noreply at atlassian.com
Fri Jun 6 02:31:32 EDT 2008
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_30341 ]
yuanqingfei commented on ANN-749:
---------------------------------
the hibernate cfg properties:
# JDBC
jdbc.driverClassName=org.hsqldb.jdbcDriver
jdbc.url=jdbc:hsqldb:mem:test
jdbc.username=sa
jdbc.password=
# Needed by Hibernate3 Maven Plugin defined in pom.xml
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.url=jdbc:hsqldb:mem:test
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
# Hibernate Settings
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.query.substitutions=true 'Y', false 'N'
hibernate.cache.use_second_level_cache=false
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
hibernate.jdbc.batch_size=0
hibernate.configLocation=classpath:hibernate.cfg.xml
#unit test
# auto schema export
hibernate.hbm2ddl.auto=create
> Generated Annotation can not generate Date automatically
> --------------------------------------------------------
>
> Key: ANN-749
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-749
> Project: Hibernate Annotations
> Issue Type: Bug
> Affects Versions: 3.3.1.GA, 3.4.0.CR1
> Environment: OS: Windows XP
> DB: HSQL
> Reporter: yuanqingfei
>
> @Before
> public void setup() {
> order = new Order();
> // enter all required fields
> order.setName("order1");
> order = orderDAO.save(order); //Hibernate should generate a timestamp here
> }
> @Test
> public void testSave() {
> assertTrue(orderDAO.exists(order.getId()));
> System.out.println(order.getCreateTime()); //here should get a date.
> }
> Annotation part in Order:
> @Temporal(TemporalType.TIMESTAMP)
> @Column(insertable = false,updatable=false)
> @org.hibernate.annotations.Generated(org.hibernate.annotations.GenerationTime.INSERT)
> private Date createTime;
> Save part in OrderDAO.
> @SuppressWarnings("unchecked")
> public T save(T object) {
> return (T) super.getHibernateTemplate().merge(object);
> }
> every time, I just only get null.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list