• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Batch Update Failure

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have a table named Contact in MYSQL. This table looks like the following:

Column Type
------------- -------------
ID decimal
FIRSTNAME varchar
LASTNAME varchar
EMAIL varchar

There is only a single row of data in the table.

This row contains the following data:

ID = 6,FIRSTNAME=Subhash,LASTNAME=Medhi,EMAIL=medhi2006@gmail.com

Corresponding to this table i have a class Contact.java. It looks like the following:



My hbm.xml file looks like this:



I have a third class in which i am trying to update table Contact. This class named as UpdateExample.java looks like the following:



When i run this class, however, i am getting the following message:



The table is not getting updated.

Could anybody kindly tell me what exactly could the problem be?

Thanks,
Subhash
 
subhashchandra medhiassam
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Could anybody kindly help me out. Please kindly help me out. It's urgent.

Thanks,
Subhash
[ September 29, 2008: Message edited by: subhashchandra medhiassam ]
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There should be more information in the error message. What else does it tell you?

This may be nothing to do with the issue, but you have modelled your contact entity with an ID attribute with the type decimal, and mapped it with the type long. You possibly want to fix that.

And please, EaseUp.
 
subhashchandra medhiassam
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's nothing more in the message.

what should be the type of column id of Contact table? Kindly help.

Thanks,
Subhash
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by subhashchandra medhiassam:
There's nothing more in the message.



This would be because you log the message the exception returns and not the stack trace. Print the stack trace and you will get more information. Hibernate always logs the underlying SQLException, which in turn always reports the database error message.


what should be the type of column id of Contact table


Decimal is usually used to store flaoting point numbers and floating point numbers are poor choices for surrogate keys. MySQL provides a variety of integer data types, I'd use one of them.
 
subhashchandra medhiassam
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have used various types like mediumint and bigint for the column ID of table Contact. But nothing works.
 
subhashchandra medhiassam
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
when i changed the program to print the stacktrace it printed the following message:



I got it. thanks.
[ September 29, 2008: Message edited by: subhashchandra medhiassam ]
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good. Worth remembering to check what is logged by Hibernate. SQLExceptions always tell you the issue - or at least as much information as the database is willing to give you.
 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the tutorial in roseIndia about hibernate has many bugs, their hibernate3.zip is old and would cause more error when you go to delete query example!!
 
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic