Hi,

I am using MySQL with "MySQL Connector/J 2.0.14" JDBC drivers.
In my test the bean property is null both before and after
update/flush, but when you load the bean from db using session.load(),
the property is "".

Attached to this mail you can find mapping file for my bean, JUnit
test (part of...) that fails and log from this test with "trace" and
"show SQL" set to true.

My JavaBean is generated from that mapping file.

thanks for your support!

jaro


GKdvga> What JDBC driver are you using? (I've got a funny feeling it might be
GKdvga> Oracle, which does not differentiate between null and the empty string in
GKdvga> its driver.)

GKdvga> Hibernate doesn't do this. Your code, or possibly your JDBC driver might do
GKdvga> it.

GKdvga> Put a breakpoint in your setter method to discover exactly *where* it gets
GKdvga> set to null and I might be able to give some more guidance....




                                                                                       
                                               
GKdvga>                     Jaroslav Misura                                            
                                                       
GKdvga>                     <[EMAIL PROTECTED]>                  To:     [EMAIL 
PROTECTED]                             
GKdvga>                     Sent by:                                cc:                
                                                       
GKdvga>                     [EMAIL PROTECTED]       Subject:     [Hibernate] null 
check and update, save                      
GKdvga>                     eforge.net                                                 
                                                       
                                                                                       
                                               
                                                                                       
                                               
GKdvga>                     18/02/03 11:35 PM                                          
                                                       
GKdvga>                     Please respond to Jaroslav Misura                          
                                                       
                                                                                       
                                               
                                                                                       
                                               




GKdvga> Hi,

GKdvga> while I was writing tests for my code I ran into one "problem". Now,
GKdvga> I'm not sure if it is a bug or a feature. I am using Hibernate 1.2.3
GKdvga> and MySQL 3.x .

GKdvga> Some of properties in my JavaBean are marked as not null. When I test
GKdvga> the code I set that property to null and try to save() it. The exception
GKdvga> is thrown - as expected. But when I try to do the same and update() the
GKdvga> code the exception is NOT thrown. Value of that property (string) is
GKdvga> set to "" instead. When I use saveOrUpdate(), it works - just like with
GKdvga> save().
GKdvga> Is there something I misunderstand with update()?

GKdvga> I have some test that shows this problem, so if this is not expected
GKdvga> behavior I can send it together with the debug info etc.

GKdvga> thanks in advance!

GKdvga> jaro.



GKdvga> -------------------------------------------------------
GKdvga> This sf.net email is sponsored by:ThinkGeek
GKdvga> Welcome to geek heaven.
GKdvga> http://thinkgeek.com/sf
GKdvga> _______________________________________________
GKdvga> hibernate-devel mailing list
GKdvga> [EMAIL PROTECTED]
GKdvga> https://lists.sourceforge.net/lists/listinfo/hibernate-devel




GKdvga> **********************************************************************
GKdvga> Any personal or sensitive information contained in this email and
GKdvga> attachments must be handled in accordance with the Victorian Information
GKdvga> Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988
GKdvga> (Commonwealth), as applicable.

GKdvga> This email, including all attachments, is confidential.  If you are not the
GKdvga> intended recipient, you must not disclose, distribute, copy or use the
GKdvga> information contained in this email or attachments.  Any confidentiality or
GKdvga> privilege is not waived or lost because this email has been sent to you in
GKdvga> error.  If you have received it in error, please let us know by reply
GKdvga> email, delete it from your system and destroy any copies.
GKdvga> **********************************************************************





GKdvga> -------------------------------------------------------
GKdvga> This sf.net email is sponsored by:ThinkGeek
GKdvga> Welcome to geek heaven.
GKdvga> http://thinkgeek.com/sf
GKdvga> _______________________________________________
GKdvga> hibernate-devel mailing list
GKdvga> [EMAIL PROTECTED]
GKdvga> https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Attachment: ArticleTest.java
Description: Binary data

Attachment: test.log
Description: Binary data

Attachment: Article.hbm.xml
Description: application/xml

Reply via email to