You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by ram <ra...@yahoo.co.in> on 2011/02/02 21:37:14 UTC
persisting object of perticular date format
I have a date in string format
format yyyy-MM-dd'T'HH:mm:ss.
e.g.2010-12-25T12:00:00
I created entity from the tables . Here is my employee entity.
Class Emp{
String id,
java.sql.date joinDate
}
As i see to_date() is not applicable in JPA, How can i persist the joined date in the same format 2010-12-25T12:00:00 into the database by using jpa.
How can i specify this format yyyy-MM-dd'T'HH:mm:ss.
Later on i want to search the emp who has joined in the format (yyyy-mm-dd) 2010-12-25, so that i can get all the values from the database
2010-12-25T12:00:00
2010-12-25T11:00:00
2010-12-25T10:05:00
@NamedQuery(name="getEmployeeByDate",query="select p from Emp p where p.joinDate =? ")
Thanks,
Ram