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.color = "black";
Sky.area = "Paris";
sky.day = "23";
sky.month = "1";
s.save( sky );
tx.commit();
s.close();

View File

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

View File

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

View File

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