[hibernate-issues] [Hibernate-JIRA] Created: (ANN-749) Generated Annotation can not generate Date automatically

yuanqingfei (JIRA) noreply at atlassian.com
Fri Jun 6 02:24:33 EDT 2008


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.4.0.CR1, 3.3.1.GA
         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