Author: andrei_exadel
Date: 2009-02-25 12:11:28 -0500 (Wed, 25 Feb 2009)
New Revision: 12745
Added:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Sex.java
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java
trunk/test-applications/realworld2/ejb/src/main/resources/import.sql
Log:
Users prefs
Added:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Sex.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Sex.java
(rev 0)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Sex.java 2009-02-25
17:11:28 UTC (rev 12745)
@@ -0,0 +1,16 @@
+package org.richfaces.realworld.domain;
+
+
+public enum Sex {
+ MALE("1"),
+ FEMALE("0");
+
+ String key;
+
+ private Sex(String key) {
+ this.key = key;
+ }
+
+
+
+}
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-02-25
16:49:08 UTC (rev 12744)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-02-25
17:11:28 UTC (rev 12745)
@@ -37,6 +37,7 @@
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@@ -129,6 +130,10 @@
@Temporal(TemporalType.TIMESTAMP)
private Date birthDate;
+ @NotEmpty
+ @NotNull
+ private Sex sex;
+
@OneToMany(mappedBy = "owner", cascade = { CascadeType.ALL}, fetch =
FetchType.LAZY)
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
@org.hibernate.annotations.OrderBy(clause = "NAME asc")
@@ -285,4 +290,14 @@
public void setShelfs(List<Shelf> shelfs) {
this.shelfs = shelfs;
}
+
+ public Sex getSex() {
+ return sex;
+ }
+
+ public void setSex(Sex sex) {
+ this.sex = sex;
+ }
+
+
}
\ No newline at end of file
Modified: trunk/test-applications/realworld2/ejb/src/main/resources/import.sql
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/resources/import.sql 2009-02-25
16:49:08 UTC (rev 12744)
+++ trunk/test-applications/realworld2/ejb/src/main/resources/import.sql 2009-02-25
17:11:28 UTC (rev 12745)
@@ -1,6 +1,6 @@
-INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate)
VALUES (1, 'Andrey', 'Markhel', 'amarkhel(a)exadel.com',
'amarkhel', '8cb2237d0679ca88db6464eac60da96345513964',
'1985-01-08');
-INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate)
VALUES (2, 'Nick', 'Curtis', 'nkurtis(a)iba.com', 'Viking',
'8cb2237d0679ca88db6464eac60da96345513964', '1978-01-08');
-INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate)
VALUES (3, 'John', 'Smith', 'jsmith(a)jboss.com', 'Noname',
'8cb2237d0679ca88db6464eac60da96345513964', '1970-01-08');
+INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate,
sex) VALUES (1, 'Andrey', 'Markhel', 'amarkhel(a)exadel.com',
'amarkhel', '8cb2237d0679ca88db6464eac60da96345513964',
'1985-01-08', 1);
+INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate,
sex) VALUES (2, 'Nick', 'Curtis', 'nkurtis(a)iba.com',
'Viking', '8cb2237d0679ca88db6464eac60da96345513964',
'1978-01-08', 1);
+INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate,
sex) VALUES (3, 'John', 'Smith', 'jsmith(a)jboss.com',
'Noname', '8cb2237d0679ca88db6464eac60da96345513964',
'1970-01-08', 1);
INSERT INTO shelfs(shelf_id, name, description, shelf_user_id) VALUES (1,
'Nature', 'Nature pictures', 1);
INSERT INTO shelfs(shelf_id, name, description, shelf_user_id) VALUES (2,
'Sport', 'Nature pictures', 1);