I have mapped a property with the Java.util.Date type to a table column in a MySQL database. It saves the whole date/time! How can I make hibernate to save only the Date and not the time. My mapping is:
<property name="registrationDate" type="java.util.Date">
<column name="regDate" length="10" />
</property>
You must have specified your column as DateTime type in your table. Just make it a Date type column. So only the date portion will be stored.
EDIT:
If you are using table auto generation you can define your java.util.date as follows;
@Temporal(DATE)
protected java.util.Date endDate;
if you are using xml configuration it can be defined as follows;
<basic name="myDate"/>
<temporal>DATE</temporal>
</basic>