Strange behaviour of save() method

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange behaviour of save() method

ymaurischat

Hello,

Im using Grails 0.5.6 on an Oracle-DB.

The contraint for a certain property in my domain class is name( nullable: true ). Unfortunately the DB has a built-in constraint that say that the name must not be null.

So i do the following:

try{
    if( !myDomainClassInstance.save() )
    {
        some error handling stuff here
    }
}
catch( Exception ex )
{
    some more error handling stuff here
}

If my name-property is "null", I get an exception (see below). BUT, neither the error-handling in if() is done (so save() seems to return "true" anyway) nor the error-handling in catch().
Isn't save() supposed to catch that exception and return false? Or shouldnt at least the try-catch-statement get hold of the exception? Instead nothing happens, my error-handling code is not even reached.


2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter - ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION") nicht möglich

2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter - ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION") nicht möglich

2007-10-05 13:35:28,157 ERROR event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)

Cheers,
Yves


smime.p7s (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Strange behaviour of save() method

ymaurischat
Ahh sorry, its  the geoLocation property... nevertheless the same problem occurs here too.

Yves Maurischat schrieb:

>
> Hello,
>
> Im using Grails 0.5.6 on an Oracle-DB.
>
> The contraint for a certain property in my domain class is name(
> nullable: true ). Unfortunately the DB has a built-in constraint that
> say that the name must not be null.
> So i do the following:
>
> try{    if( !myDomainClassInstance.save() )
>    {        some error handling stuff here    }
> }
> catch( Exception ex )
> {
>    some more error handling stuff here }
>
> If my name-property is "null", I get an exception (see below). BUT,
> neither the error-handling in if() is done (so save() seems to return
> "true" anyway) nor the error-handling in catch(). Isn't save() supposed
> to catch that exception and return false? Or shouldnt at least the
> try-catch-statement get hold of the exception? Instead nothing happens,
> my error-handling code is not even reached.
>
>
> 2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter -
> ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION") nicht
> möglich
>
> 2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter -
> ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION") nicht
> möglich
>
> 2007-10-05 13:35:28,157 ERROR event.def.AbstractFlushingEventListener -
> Could not synchronize database state with session
> org.hibernate.exception.ConstraintViolationException: Could not execute
> JDBC batch update
>   at
> org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
>
>   at
> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
>
>   at
> org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
>   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
>   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
>   at
> org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
>
>
> Cheers,
> Yves
>

--
media transfer AG
Yves Maurischat
Dolivostrasse 11
D-64293 Darmstadt
Germany

Phone: (+49) (0) 61 51 / 81 93 37
Fax:   (+49) (0) 61 51 / 81 93 41
eMail: [hidden email]
WWW:   http://www.mtg.de 


media transfer AG

Firmensitz: Dolivostr. 11,  64293 Darmstadt
Registergericht: Amtsgericht Darmstadt, HRB 8901
Vorstand: Dr. Hans-Detlef Schulz
Aufsichtsratsvorsitzender: Dr. Thomas Milde


smime.p7s (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Strange behaviour of save() method

Christian Laakmann
Hibernate collects all changes to the domain objects in a queue which is sent to the database, when the transaction is commited or the session is flushed.
The commit or the flush happen, after your code has executed without errors and the exception ist thrown somewhere deep in the grails interna.

Try to set the nullable constraint to true or try to flush the session after you save you domainInstance.

cheers

<quote author="Yves Maurischat">
Ahh sorry, its  the geoLocation property... nevertheless the same problem occurs here too.

Yves Maurischat schrieb:
>
> Hello,
>
> Im using Grails 0.5.6 on an Oracle-DB.
>
> The contraint for a certain property in my domain class is name(
> nullable: true ). Unfortunately the DB has a built-in constraint that
> say that the name must not be null.
> So i do the following:
>
> try{    if( !myDomainClassInstance.save() )
>    {        some error handling stuff here    }
> }
> catch( Exception ex )
> {
>    some more error handling stuff here }
>
> If my name-property is "null", I get an exception (see below). BUT,
> neither the error-handling in if() is done (so save() seems to return
> "true" anyway) nor the error-handling in catch(). Isn't save() supposed
> to catch that exception and return false? Or shouldnt at least the
> try-catch-statement get hold of the exception? Instead nothing happens,
> my error-handling code is not even reached.
>
>
> 2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter -
> ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION") nicht
> möglich
>
> 2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter -
> ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION") nicht
> möglich
>
> 2007-10-05 13:35:28,157 ERROR event.def.AbstractFlushingEventListener -
> Could not synchronize database state with session
> org.hibernate.exception.ConstraintViolationException: Could not execute
> JDBC batch update
>   at
> org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
>
>   at
> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
>
>   at
> org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
>   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
>   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
>   at
> org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)

Reply | Threaded
Open this post in threaded view
|

Re: Strange behaviour of save() method

ymaurischat
In reply to this post by ymaurischat
Well, the constraint was easy to fix, but I am more concerned with the fact that the save()-method returns true. The problem is, that some other things in my application depend on what happens in the error handling. But if no error handling is done it can lead to inconsistencies in my application (as hibenate does a roll-back of only the last action, not the ones that might have happened before like adding other domain objects).

I have a one-to-many relationship (with the object that caused the exception on the many-side) where the owner has to be deleted when the last of its children (the manies ;) has gone. So, if i create the owner and add one child, but the saving of the child produces an exception and is rolled-back, my owner would be still in the DB, which is bad. If the last child is removed the "normal" way (ie by a user action) i remove the owner programmatically because there are also some other actions to be done then, like communicating the deletion of the owner to some other servers.
But with the exception not being caught this is not possible, thus creating inconsistencies in my application.
Or is there any way trigger the necessary actions in the described error case that I am not aware of?

Cheers,
Yves


[hidden email] schrieb:

> Hibernate collects all changes to the domain objects within a transaction. As soon as the session is flushed or the transaction is commited, all the changes are sent to the database.
>
> The exception is thrown after your code has executed, somewhere deep in the grails interna. You could get around this by setting the nullable-constraint to false in your domain class.
>
> cheers
>
>
> Yves Maurischat wrote:
>> Ahh sorry, its  the geoLocation property... nevertheless the same problem
>> occurs here too.
>>
>> Yves Maurischat schrieb:
>>> Hello,
>>>
>>> Im using Grails 0.5.6 on an Oracle-DB.
>>>
>>> The contraint for a certain property in my domain class is name(
>>> nullable: true ). Unfortunately the DB has a built-in constraint that
>>> say that the name must not be null.
>>> So i do the following:
>>>
>>> try{    if( !myDomainClassInstance.save() )
>>>    {        some error handling stuff here    }
>>> }
>>> catch( Exception ex )
>>> {
>>>    some more error handling stuff here }
>>>
>>> If my name-property is "null", I get an exception (see below). BUT,
>>> neither the error-handling in if() is done (so save() seems to return
>>> "true" anyway) nor the error-handling in catch(). Isn't save() supposed
>>> to catch that exception and return false? Or shouldnt at least the
>>> try-catch-statement get hold of the exception? Instead nothing happens,
>>> my error-handling code is not even reached.
>>>
>>>
>>> 2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter -
>>> ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION") nicht
>>> möglich
>>>
>>> 2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter -
>>> ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION") nicht
>>> möglich
>>>
>>> 2007-10-05 13:35:28,157 ERROR event.def.AbstractFlushingEventListener -
>>> Could not synchronize database state with session
>>> org.hibernate.exception.ConstraintViolationException: Could not execute
>>> JDBC batch update
>>>   at
>>> org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
>>>
>>>   at
>>> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
>>>
>>>   at
>>> org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
>>>   at
>>> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
>>>   at
>>> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
>>>   at
>>> org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
>>>
>>>
>>> Cheers,
>>> Yves
>>>
>>
>> --
>> media transfer AG
>> Yves Maurischat
>> Dolivostrasse 11
>> D-64293 Darmstadt
>> Germany
>>
>> Phone: (+49) (0) 61 51 / 81 93 37
>> Fax:   (+49) (0) 61 51 / 81 93 41
>> eMail: [hidden email]
>> WWW:   http://www.mtg.de 
>>
>>
>> media transfer AG
>>
>> Firmensitz: Dolivostr. 11,  64293 Darmstadt
>> Registergericht: Amtsgericht Darmstadt, HRB 8901
>> Vorstand: Dr. Hans-Detlef Schulz
>> Aufsichtsratsvorsitzender: Dr. Thomas Milde
>>
>>
>>  
>>
> Quoted from:
> http://www.nabble.com/Strange-behaviour-of-save%28%29-method-tf4574935.html#a13058656
>

--
media transfer AG
Yves Maurischat
Dolivostrasse 11
D-64293 Darmstadt
Germany

Phone: (+49) (0) 61 51 / 81 93 37
Fax:   (+49) (0) 61 51 / 81 93 41
eMail: [hidden email]
WWW:   http://www.mtg.de 


media transfer AG

Firmensitz: Dolivostr. 11,  64293 Darmstadt
Registergericht: Amtsgericht Darmstadt, HRB 8901
Vorstand: Dr. Hans-Detlef Schulz
Aufsichtsratsvorsitzender: Dr. Thomas Milde


smime.p7s (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Strange behaviour of save() method

Christian Laakmann

Yves Maurischat wrote
Well, the constraint was easy to fix, but I am more concerned with the fact that the save()-method returns true. The problem is, that some other things in my application depend on what happens in the error handling. But if no error handling is done it can lead to inconsistencies in my application (as hibenate does a roll-back of only the last action, not the ones that might have happened before like adding other domain objects).
save() should not return true if the validation fails - that's the way it *should* (in my opinion) work, dunno if this is the actual behaviour.

of course, you could first call instance.validate() to see if your instance is valid and call save() only if it returns true.

Yves Maurischat wrote
I have a one-to-many relationship (with the object that caused the exception on the many-side) where the owner has to be deleted when the last of its children (the manies ;) has gone. So, if i create the owner and add one child, but the saving of the child produces an exception and is rolled-back, my owner would be still in the DB, which is bad. If the last child is removed the "normal" way (ie by a user action) i remove the owner programmatically because there are also some other actions to be done then, like communicating the deletion of the owner to some other servers.
But with the exception not being caught this is not possible, thus creating inconsistencies in my application.
Or is there any way trigger the necessary actions in the described error case that I am not aware of?
If you create the owner and set it's child in the same transaction, both changes - creation and setting the child should be rolled back automatically.

If nothing helps, you could try Hibernate's interceptors, although I don't know whether those will help you.

Christian
Reply | Threaded
Open this post in threaded view
|

RE: Re: Strange behaviour of save() method

brassrat
In reply to this post by ymaurischat
as was pointed out, the save() method does not necessarily actually interact with the database.
Only by explictly flush()ing the session are you guaranteed to have actually sent anything to the database server.
When a session is closed it is first flushed()ed; however, hibernate may cause dirty objects to be flushed arbitrarily
So while you can depend upon the save() method to fail if your specified validations are not satisfied, you can not depend upon the save() method to indicate what would happen if you actually sent the data to the database server.
Moreover, depending upon when the actual flush() operation takes place, fails, and an Exception is thrown you may or may not be in control of the execution context. E.g., if the session is being provided by a container then it may not be until the container closes the session and thus your code may not be executing at that time.

So, don't be concerned that save() returns true ... its probably working fine - if its defined as having the same semantics as hibernate.

And here, imho, is where the real issue lies. Its all well and good for grails/groovy to 'hide' most of the details of dealing with hibernate, but what to do about these somewhat subtle semantics?
For sure, it would seem that a save is a save is a save, when i say save(), do it. But hibernate, in trying to optimize interactions with the database server says, well, not quite, i hear you, and i'll do what you want, but not quite now. Leading to a mismatch between the programmer's expectations and the actual behavior.
Maybe a grails save() should always flush()? and maybe there should be some other method which more clearly indicates what the actual hibernate semantics are?



-----Original Message-----
From: Yves Maurischat [mailto:[hidden email]]
Sent: Friday, October 05, 2007 9:37 AM
To: [hidden email]
Subject: [grails-user] Re: Strange behaviour of save() method

Well, the constraint was easy to fix, but I am more concerned with the fact that the save()-method returns true. The problem is, that some other things in my application depend on what happens in the error handling. But if no error handling is done it can lead to inconsistencies in my application (as hibenate does a roll-back of only the last action, not the ones that might have happened before like adding other domain objects).

I have a one-to-many relationship (with the object that caused the exception on the many-side) where the owner has to be deleted when the last of its children (the manies ;) has gone. So, if i create the owner and add one child, but the saving of the child produces an exception and is rolled-back, my owner would be still in the DB, which is bad. If the last child is removed the "normal" way (ie by a user action) i remove the owner programmatically because there are also some other actions to be done then, like communicating the deletion of the owner to some other servers.
But with the exception not being caught this is not possible, thus creating inconsistencies in my application.
Or is there any way trigger the necessary actions in the described error case that I am not aware of?

Cheers,
Yves


[hidden email] schrieb:

> Hibernate collects all changes to the domain objects within a transaction. As soon as the session is flushed or the transaction is commited, all the changes are sent to the database.
>
> The exception is thrown after your code has executed, somewhere deep in the grails interna. You could get around this by setting the nullable-constraint to false in your domain class.
>
> cheers
>
>
> Yves Maurischat wrote:
>> Ahh sorry, its  the geoLocation property... nevertheless the same
>> problem occurs here too.
>>
>> Yves Maurischat schrieb:
>>> Hello,
>>>
>>> Im using Grails 0.5.6 on an Oracle-DB.
>>>
>>> The contraint for a certain property in my domain class is name(
>>> nullable: true ). Unfortunately the DB has a built-in constraint
>>> that say that the name must not be null.
>>> So i do the following:
>>>
>>> try{    if( !myDomainClassInstance.save() )
>>>    {        some error handling stuff here    }
>>> }
>>> catch( Exception ex )
>>> {
>>>    some more error handling stuff here }
>>>
>>> If my name-property is "null", I get an exception (see below). BUT,
>>> neither the error-handling in if() is done (so save() seems to
>>> return "true" anyway) nor the error-handling in catch(). Isn't
>>> save() supposed to catch that exception and return false? Or
>>> shouldnt at least the try-catch-statement get hold of the exception?
>>> Instead nothing happens, my error-handling code is not even reached.
>>>
>>>
>>> 2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter -
>>> ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION")
>>> nicht möglich
>>>
>>> 2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter -
>>> ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION")
>>> nicht möglich
>>>
>>> 2007-10-05 13:35:28,157 ERROR
>>> event.def.AbstractFlushingEventListener - Could not synchronize
>>> database state with session
>>> org.hibernate.exception.ConstraintViolationException: Could not
>>> execute JDBC batch update
>>>   at
>>> org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.
>>> java:71)
>>>
>>>   at
>>> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHel
>>> per.java:43)
>>>
>>>   at
>>> org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
>>>   at
>>> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
>>>   at
>>> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
>>>   at
>>> org.hibernate.event.def.AbstractFlushingEventListener.performExecuti
>>> ons(AbstractFlushingEventListener.java:298)
>>>
>>>
>>> Cheers,
>>> Yves
>>>
>>
>> --
>> media transfer AG
>> Yves Maurischat
>> Dolivostrasse 11
>> D-64293 Darmstadt
>> Germany
>>
>> Phone: (+49) (0) 61 51 / 81 93 37
>> Fax:   (+49) (0) 61 51 / 81 93 41
>> eMail: [hidden email]
>> WWW:   http://www.mtg.de 
>>
>>
>> media transfer AG
>>
>> Firmensitz: Dolivostr. 11,  64293 Darmstadt
>> Registergericht: Amtsgericht Darmstadt, HRB 8901
>> Vorstand: Dr. Hans-Detlef Schulz
>> Aufsichtsratsvorsitzender: Dr. Thomas Milde
>>
>>
>>  
>>
> Quoted from:
> http://www.nabble.com/Strange-behaviour-of-save%28%29-method-tf4574935
> .html#a13058656
>


--
media transfer AG
Yves Maurischat
Dolivostrasse 11
D-64293 Darmstadt
Germany

Phone: (+49) (0) 61 51 / 81 93 37
Fax:   (+49) (0) 61 51 / 81 93 41
eMail: [hidden email]
WWW:   http://www.mtg.de 


media transfer AG

Firmensitz: Dolivostr. 11,  64293 Darmstadt
Registergericht: Amtsgericht Darmstadt, HRB 8901
Vorstand: Dr. Hans-Detlef Schulz
Aufsichtsratsvorsitzender: Dr. Thomas Milde



---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Re: Strange behaviour of save() method

graemer
There is a

obj.save(flush:true)

To deal with this scenario. And in SVN head there is also a

obj.delete(flush:true)

Cheers

On 10/5/07, Jay Goldman <[hidden email]> wrote:

> as was pointed out, the save() method does not necessarily actually interact with the database.
> Only by explictly flush()ing the session are you guaranteed to have actually sent anything to the database server.
> When a session is closed it is first flushed()ed; however, hibernate may cause dirty objects to be flushed arbitrarily
> So while you can depend upon the save() method to fail if your specified validations are not satisfied, you can not depend upon the save() method to indicate what would happen if you actually sent the data to the database server.
> Moreover, depending upon when the actual flush() operation takes place, fails, and an Exception is thrown you may or may not be in control of the execution context. E.g., if the session is being provided by a container then it may not be until the container closes the session and thus your code may not be executing at that time.
>
> So, don't be concerned that save() returns true ... its probably working fine - if its defined as having the same semantics as hibernate.
>
> And here, imho, is where the real issue lies. Its all well and good for grails/groovy to 'hide' most of the details of dealing with hibernate, but what to do about these somewhat subtle semantics?
> For sure, it would seem that a save is a save is a save, when i say save(), do it. But hibernate, in trying to optimize interactions with the database server says, well, not quite, i hear you, and i'll do what you want, but not quite now. Leading to a mismatch between the programmer's expectations and the actual behavior.
> Maybe a grails save() should always flush()? and maybe there should be some other method which more clearly indicates what the actual hibernate semantics are?
>
>
>
> -----Original Message-----
> From: Yves Maurischat [mailto:[hidden email]]
> Sent: Friday, October 05, 2007 9:37 AM
> To: [hidden email]
> Subject: [grails-user] Re: Strange behaviour of save() method
>
> Well, the constraint was easy to fix, but I am more concerned with the fact that the save()-method returns true. The problem is, that some other things in my application depend on what happens in the error handling. But if no error handling is done it can lead to inconsistencies in my application (as hibenate does a roll-back of only the last action, not the ones that might have happened before like adding other domain objects).
>
> I have a one-to-many relationship (with the object that caused the exception on the many-side) where the owner has to be deleted when the last of its children (the manies ;) has gone. So, if i create the owner and add one child, but the saving of the child produces an exception and is rolled-back, my owner would be still in the DB, which is bad. If the last child is removed the "normal" way (ie by a user action) i remove the owner programmatically because there are also some other actions to be done then, like communicating the deletion of the owner to some other servers.
> But with the exception not being caught this is not possible, thus creating inconsistencies in my application.
> Or is there any way trigger the necessary actions in the described error case that I am not aware of?
>
> Cheers,
> Yves
>
>
> [hidden email] schrieb:
> > Hibernate collects all changes to the domain objects within a transaction. As soon as the session is flushed or the transaction is commited, all the changes are sent to the database.
> >
> > The exception is thrown after your code has executed, somewhere deep in the grails interna. You could get around this by setting the nullable-constraint to false in your domain class.
> >
> > cheers
> >
> >
> > Yves Maurischat wrote:
> >> Ahh sorry, its  the geoLocation property... nevertheless the same
> >> problem occurs here too.
> >>
> >> Yves Maurischat schrieb:
> >>> Hello,
> >>>
> >>> Im using Grails 0.5.6 on an Oracle-DB.
> >>>
> >>> The contraint for a certain property in my domain class is name(
> >>> nullable: true ). Unfortunately the DB has a built-in constraint
> >>> that say that the name must not be null.
> >>> So i do the following:
> >>>
> >>> try{    if( !myDomainClassInstance.save() )
> >>>    {        some error handling stuff here    }
> >>> }
> >>> catch( Exception ex )
> >>> {
> >>>    some more error handling stuff here }
> >>>
> >>> If my name-property is "null", I get an exception (see below). BUT,
> >>> neither the error-handling in if() is done (so save() seems to
> >>> return "true" anyway) nor the error-handling in catch(). Isn't
> >>> save() supposed to catch that exception and return false? Or
> >>> shouldnt at least the try-catch-statement get hold of the exception?
> >>> Instead nothing happens, my error-handling code is not even reached.
> >>>
> >>>
> >>> 2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter -
> >>> ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION")
> >>> nicht möglich
> >>>
> >>> 2007-10-05 13:35:28,157 ERROR hibernate.util.JDBCExceptionReporter -
> >>> ORA-01400: Einfügen von NULL in ("CDN"."AUFTRAG"."GEO_LOCATION")
> >>> nicht möglich
> >>>
> >>> 2007-10-05 13:35:28,157 ERROR
> >>> event.def.AbstractFlushingEventListener - Could not synchronize
> >>> database state with session
> >>> org.hibernate.exception.ConstraintViolationException: Could not
> >>> execute JDBC batch update
> >>>   at
> >>> org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.
> >>> java:71)
> >>>
> >>>   at
> >>> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHel
> >>> per.java:43)
> >>>
> >>>   at
> >>> org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
> >>>   at
> >>> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
> >>>   at
> >>> org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
> >>>   at
> >>> org.hibernate.event.def.AbstractFlushingEventListener.performExecuti
> >>> ons(AbstractFlushingEventListener.java:298)
> >>>
> >>>
> >>> Cheers,
> >>> Yves
> >>>
> >>
> >> --
> >> media transfer AG
> >> Yves Maurischat
> >> Dolivostrasse 11
> >> D-64293 Darmstadt
> >> Germany
> >>
> >> Phone: (+49) (0) 61 51 / 81 93 37
> >> Fax:   (+49) (0) 61 51 / 81 93 41
> >> eMail: [hidden email]
> >> WWW:   http://www.mtg.de
> >>
> >>
> >> media transfer AG
> >>
> >> Firmensitz: Dolivostr. 11,  64293 Darmstadt
> >> Registergericht: Amtsgericht Darmstadt, HRB 8901
> >> Vorstand: Dr. Hans-Detlef Schulz
> >> Aufsichtsratsvorsitzender: Dr. Thomas Milde
> >>
> >>
> >>
> >>
> > Quoted from:
> > http://www.nabble.com/Strange-behaviour-of-save%28%29-method-tf4574935
> > .html#a13058656
> >
>
>
> --
> media transfer AG
> Yves Maurischat
> Dolivostrasse 11
> D-64293 Darmstadt
> Germany
>
> Phone: (+49) (0) 61 51 / 81 93 37
> Fax:   (+49) (0) 61 51 / 81 93 41
> eMail: [hidden email]
> WWW:   http://www.mtg.de
>
>
> media transfer AG
>
> Firmensitz: Dolivostr. 11,  64293 Darmstadt
> Registergericht: Amtsgericht Darmstadt, HRB 8901
> Vorstand: Dr. Hans-Detlef Schulz
> Aufsichtsratsvorsitzender: Dr. Thomas Milde
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--
Graeme Rocher
Grails Project Lead
http://grails.org

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email