This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Trouble running example from Hibernate Made Easy, p. 156 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Trouble running example from Hibernate Made Easy, p. 156" Watch "Trouble running example from Hibernate Made Easy, p. 156" New topic
Author

Trouble running example from Hibernate Made Easy, p. 156

Matthew Busse
Ranch Hand

Joined: Sep 29, 2010
Posts: 52
Hello Ranchers,

I'm working my way through the Hibernate Made Easy book, and it's been great so far, but I'm stuck on the example on p.156.

When I try to run the User class, I get this error: "java.sql.SQLException: Data too long for column 'verified' at row 1"

Here's my code, I checked it several times to make sure I didn't miss anything:



I don't understand by Boolean.FALSE is too big to fit in verified column.

Thanks!
Matt
Oliver Chua
Greenhorn

Joined: Feb 27, 2004
Posts: 29
Hi,

In your log4j.properties, add this

so you can see the sql statements

I've tried recreating the problem but it worked fine for me.
Below are the log entries when creating the table and inserting a record

CREATE TABLE "Individual_Simple_Entity1"
(
"ID" NUMBER(19,0) NOT NULL ENABLE,
"BOOLEANFIELD" NUMBER(1,0) NOT NULL ENABLE,
PRIMARY KEY ("ID") ENABLE
)

insert into Individual_Simple_Entity1 (booleanField, id) values (?, ?)
binding 'true' to parameter: 1
binding '1' to parameter: 2

in the db, the value of booleanField becomes 1
Liu Xing
Greenhorn

Joined: Jul 19, 2010
Posts: 12
Oliver Chua wrote:Hi,

In your log4j.properties, add this

so you can see the sql statements

I've tried recreating the problem but it worked fine for me.
Below are the log entries when creating the table and inserting a record

CREATE TABLE "Individual_Simple_Entity1"
(
"ID" NUMBER(19,0) NOT NULL ENABLE,
"BOOLEANFIELD" NUMBER(1,0) NOT NULL ENABLE,
PRIMARY KEY ("ID") ENABLE
)

insert into Individual_Simple_Entity1 (booleanField, id) values (?, ?)
binding 'true' to parameter: 1
binding '1' to parameter: 2

in the db, the value of booleanField becomes 1

Thank you very much.
You are quite right.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Trouble running example from Hibernate Made Easy, p. 156
 
Similar Threads
Hibernate Question
mapping column of Date type
Incorrect syntax near the keyword
Quering on multiple tables using criteria api
Hibernate Question