Meaningless Drivel is fun!*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
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.
 
wood burning stoves
 
subject: Trouble running example from Hibernate Made Easy, p. 156
 
Similar Threads
Incorrect syntax near the keyword
Quering on multiple tables using criteria api
Hibernate Question
Hibernate Question
mapping column of Date type