ANN-822 mark unique columns as nullable=false

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@16414 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Emmanuel Bernard 2009-04-23 05:56:50 +00:00
parent 359f7e88b1
commit 6c90c9cf5b
4 changed files with 7 additions and 3 deletions

View File

@ -260,6 +260,8 @@ public class EntityTest extends TestCase {
sky.id = new Long( 1 ); sky.id = new Long( 1 );
sky.color = "black"; sky.color = "black";
Sky.area = "Paris"; Sky.area = "Paris";
sky.day = "23";
sky.month = "1";
s.save( sky ); s.save( sky );
tx.commit(); tx.commit();
s.close(); s.close();

View File

@ -18,10 +18,11 @@ import javax.persistence.UniqueConstraint;
public class Sky implements Serializable { public class Sky implements Serializable {
@Id @Id
protected Long id; protected Long id;
@Column(unique = true, columnDefinition = "varchar(250)") @Column(unique = true, columnDefinition = "varchar(250)", nullable = false)
protected String color; protected String color;
@Column(nullable = false)
protected String day; protected String day;
@Column(name = "MONTH") @Column(name = "MONTH", nullable = false)
protected String month; protected String month;
static protected String area; static protected String area;
} }

View File

@ -83,7 +83,7 @@ public class Cat implements Serializable {
return storyPart1; return storyPart1;
} }
@Column(table = "Cat2") @Column(table = "Cat2", nullable = false)
public String getStoryPart2() { public String getStoryPart2() {
return storyPart2; return storyPart2;
} }

View File

@ -95,6 +95,7 @@ public class JoinTest extends TestCase {
Life life = new Life(); Life life = new Life();
Cat cat = new Cat(); Cat cat = new Cat();
cat.setName( "kitty" ); cat.setName( "kitty" );
cat.setStoryPart2( "and the story continues" );
life.duration = 15; life.duration = 15;
life.fullDescription = "Long long description"; life.fullDescription = "Long long description";
life.owner = cat; life.owner = cat;