I think I could have stated this a little better. I am trying to
figure out how to use the default value on the database. The
database schema is the only place that I am not allowing null
values. I understand that hibernate will insert whatever value
that I tell it. This is what I am trying to prevent. When I
do an insert on a newly created object, I don't want to insert one of
the properties, I want the database to set the default value for
me. I know I could just remove the property from the hibernate
config, but then I would not be able to read or update the field in the
database. I was hoping that If I set the property to null on the
object, hibernate would read my mind and use the database default
value. :)
There certainly has to be a way to do this.
Thanks for the input.
On 7/20/05, Kedar Jog <kedar.jog@xxxxxxxxx> wrote:
Hibernate will try and insert whatever the value of the property in your object is if null it will try and persist a null value so on and so forth
if the column is not null in the schema why are u passing in a nul
value ? if u expect the value to be null , change your xdoclet tags to reflect this situation regenerate your hbm files and regen and redeploy the schema you can also use @hibernate.property formula="some
sql stmt" to add a default computed value....
Kedar Jog Senior J2EE Engineer MedPlus (www.medplus.com)
On 7/20/05, Bill Manuel <
bill.manuel@xxxxxxxxx> wrote: > Does anyone know how to make hibernate accept the default values of the > database on an insert? The column in the database is not nullable, so when > I set the value of the property to null, the database crys becasue of the
> null value. > > Any help is appreciated. > > Thanks > Bill Manuel >
-- Regards
Kedar
----------------------------------- Kedar Jog 5908 Monassas Run Rd
Milford OH 45150
--------- You may unsubscribe from this mailing list by sending a blank email addressed to: users-unsubscribe@xxxxxxxxxx
--
Find additional help by sending a blank email addressed to: users-help@xxxxxxxxxx
|