agr32 wrote:
Hi All,
I am seeing some strange behavior on SQL Server where, when I drop a row into a hibernate-managed table, a column of type "date" is being persisted incorrectly. The date information is being stored fine (year, month, and day), but the time information is being lost.
I tried adding a column tag with sql-type="datetime", but that is giving me a SQLException ("Parameter index out of range") when I try to persist a new row (SchemaExport is okay with it, however).
Any thoughts as to how I can get time information into the DB? I would like to keep my backing date object as a java.util.Date, if possible.
Thanks in advance,
agr32
FYI, I figured out how to get this to work (thanks to the old forum). You simply remove the type="date" attribute of the property, so your property looks like:
Code:
<property name="insertedDate" column="inserted_date">
<column name="inserted_date" sql-type="datetime" length="8"/>
</property>
Enjoy,
agr32