Batch Update Failure
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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 protected]
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
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 protected]
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
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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 ]
Could anybody kindly help me out. Please kindly help me out. It's urgent.
Thanks,
Subhash
[ September 29, 2008: Message edited by: subhashchandra medhiassam ]
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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.
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
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
There's nothing more in the message.
what should be the type of column id of Contact table? Kindly help.
Thanks,
Subhash
what should be the type of column id of Contact table? Kindly help.
Thanks,
Subhash
posted 17 years ago
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.
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.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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 ]
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 ]
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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.
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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!!
| You get good luck from rubbing the belly of a tiny ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |








