-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: java.sql.BatchUpdateException: Data truncation: NULL
PostPosted: Thu Aug 24, 2006 5:51 pm 
Newbie

Joined: Thu Aug 03, 2006 5:50 am
Posts: 15
HI,

I have a stupid problem:

I have an entity called DSTST wich has a 1:n relationship to POL.

Now if I want to update my DSTST there is always popping up this exception (see bottom).

I know that setting the DSTSTBO_FK option not-null="false" would help and I have also tried it already. BUT I DON'T UNDERSTAND why hibernate perfoms an update to my POL Entity (see bottom) even if I don't change it.

Hope YOU can help me,

Regards,
Peterson



Full stack trace of any exception that occurs:


org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:91)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:86)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:171)
at org.hibernate.persister.collection.AbstractCollectionPersister.remove(AbstractCollectionPersister.java:965)
at org.hibernate.action.CollectionRemoveAction.execute(CollectionRemoveAction.java:28)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at at.bias.DststBOFacade(DststBOFacade.java:21)
at at.bias.service.BasicServiceImpl.insertDstst(BasicServiceImpl.java:150)
at pipbasis.Main.main(Main.java:91)
Caused by: java.sql.BatchUpdateException: Data truncation: Column set to default value; NULL supplied to NOT NULL column 'DStST_FK' at row 1
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
... 16 more

Name and version of the database you are using: MYSQL 5

Debug level Hibernate log excerpt:

Hibernate: update DSTST set dststidnum=?, name=?, adress=?, SEKTORBO_FK=?, GEMEINDEBO_FK=? where dststid=?
Hibernate: update POL set DSTSTBO_FK=null where DSTSTBO_FK=?


Hibernate version: 3.1


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 6:00 pm 
Newbie

Joined: Thu Aug 03, 2006 5:50 am
Posts: 15
hey guys,

think i got it.

Had a bad mistake in my DTO's, which did not care about my POL Objects.

Anyway, now I know how to solve the problem

Regards,

Peterson


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 7:11 pm 
Newbie

Joined: Thu Aug 03, 2006 5:50 am
Posts: 15
nonetheless I am pretty confused why hibernate updates the foreign keys and sets them to null und updates them to the actual value afterwards ??

Can anybody explain that??


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 7:11 pm 
Newbie

Joined: Thu Aug 03, 2006 5:50 am
Posts: 15
BTW:

Here my Hibernate Log that gives you a picture:

Hibernate: update DSTST set dststidnum=?, name=?, adresse=?, email=?, SEKTORBO_FK=?, GEMBO_FK=? where dststid=?
Hibernate: update GEM set DSTSTBO_FK=null where DSTSTBO_FK=?
Hibernate: update POL set DSTSTBO_FK=null where DSTSTBO_FK=?
Hibernate: update POL set DSTSTZUTEILBO_FK=null where DSTSTZUTEILBO_FK=?
Hibernate: update GEM set DSTSTBO_FK=? where GEMid=?
Hibernate: update GEM set DSTSTBO_FK=? where GEMid=?
Hibernate: update GEM set DSTSTBO_FK=? where GEMid=?
Hibernate: update GEM set DSTSTBO_FK=? where GEMid=?
Hibernate: update POL set DSTSTBO_FK=? where POLid=?
Hibernate: update POL set DSTSTBO_FK=? where POLid=?
Hibernate: update POL set DSTSTZUTEILBO_FK=? where POLid=?
Hibernate: update POL set DSTSTZUTEILBO_FK=? where POLid=?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 7:54 pm 
Newbie

Joined: Thu Aug 03, 2006 5:50 am
Posts: 15
Okay, now I finally understood it:

I had to set :
inverse="true" at the hibernate.set


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.