jimgardener
unread,Sep 1, 2011, 9:31:23 AM9/1/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to play-framework
I was writing the model as
@Entity
class Item{
...
@MaxSize(1000)
public String description;
..
}
When I used postgres as db, and ran the app ,it worked fine.
I used psql to examine the Item table (created without specifying
Column length) and found that,
id | bigint | not null
description | text |
name | character varying(255) |
Then I tried to run tests and it failed at loading data.yml
18:20:11,417 WARN ~ SQL Error: 90005, SQLState: 90005
18:20:11,417 ERROR ~ Value too long for column "DESCRIPTION
VARCHAR(255)": "STRINGDECODE('some big string... (287)"; SQL
statement:
insert into Item (creator_id, description, name, price, id) values
(?, ?, ?, ?, ?) [90005-149]
Then I modified the model and specified column length as below
@Entity
class Item{
...
@MaxSize(1000)
@Column(name="description",length=1000)
public String description;
..
}
Then the test successfully loaded data.yml.
What I am wondering is ,how postgres was able to assign column type of
description as 'text',and that of name as varchar(255) , even without
my specifying column length of 'description'.I know it is not play
specific..but I am curious about this.