[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model ...
Christian Bauer
christian at hibernate.org
Thu Apr 19 14:36:11 EDT 2007
User: cbauer
Date: 07/04/19 14:36:11
Modified: examples/wiki/src/main/org/jboss/seam/wiki/core/model
FeedEntry.java Role.java UserImage.java Node.java
File.java Feed.java User.java Directory.java
Comment.java
Log:
Finalized 'deletion' of stuff with updated FK constraint rules, now required the very latest Hibernate JARs
Revision Changes Path
1.4 +1 -12 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FeedEntry.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- FeedEntry.java 19 Apr 2007 14:58:32 -0000 1.3
+++ FeedEntry.java 19 Apr 2007 18:36:11 -0000 1.4
@@ -47,16 +47,13 @@
@Length(min = 1, max = 32768)
private String descriptionValue;
- @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
- @JoinColumn(name = "DOCUMENT_ID", nullable = false, updatable = false)
- private Document document;
-
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "FEED_FEEDENTRY",
joinColumns = @JoinColumn(name = "FEEDENTRY_ID", nullable = false, updatable = false),
inverseJoinColumns= @JoinColumn(name = "FEED_ID", nullable = false, updatable = false)
)
+ @org.hibernate.annotations.ForeignKey(name = "FK_FEED_FEEDENTRY_FEEDENTRY_ID", inverseName = "FK_FEED_FEEDENTRY_FEED_ID")
private Set<Feed> feeds = new HashSet<Feed>();
public FeedEntry() {}
@@ -128,14 +125,6 @@
return getDescriptionValue().replaceAll("\\<.*?\\>","");
}
- public Document getDocument() {
- return document;
- }
-
- public void setDocument(Document document) {
- this.document = document;
- }
-
public Set<Feed> getFeeds() {
return feeds;
}
1.5 +1 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Role.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Role.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Role.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Role.java 19 Apr 2007 14:58:32 -0000 1.4
+++ Role.java 19 Apr 2007 18:36:11 -0000 1.5
@@ -7,7 +7,7 @@
import java.util.Date;
@Entity
- at Table(name = "ROLE")
+ at Table(name = "ROLES")
public class Role implements Serializable, Comparable {
@Id
1.3 +2 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserImage.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UserImage.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserImage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- UserImage.java 19 Apr 2007 14:58:32 -0000 1.2
+++ UserImage.java 19 Apr 2007 18:36:11 -0000 1.3
@@ -22,6 +22,8 @@
@ManyToOne
@JoinColumn(name = "USER_ID")
+ @org.hibernate.annotations.ForeignKey(name = "FK_USER_IMAGE_USER_ID")
+ @org.hibernate.annotations.OnDelete(action = org.hibernate.annotations.OnDeleteAction.CASCADE)
private User user;
@Lob
1.10 +4 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Node.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Node.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Node.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- Node.java 19 Apr 2007 14:58:32 -0000 1.9
+++ Node.java 19 Apr 2007 18:36:11 -0000 1.10
@@ -65,6 +65,8 @@
// Required EAGER loading, we cast this to 'Directory' sometimes and proxy wouldn't work
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "PARENT_NODE_ID", nullable = true, insertable = false, updatable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_NODE_PARENT_NODE_ID")
+ @org.hibernate.annotations.OnDelete(action = org.hibernate.annotations.OnDeleteAction.CASCADE)
protected Node parent;
@OneToMany(fetch = FetchType.LAZY)
@@ -83,6 +85,7 @@
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "CREATED_BY_USER_ID", nullable = false, updatable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_NODE_CREATED_BY_USER_ID")
protected User createdBy;
@Column(name = "LAST_MODIFIED_ON")
@@ -90,6 +93,7 @@
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "LAST_MODIFIED_BY_USER_ID")
+ @org.hibernate.annotations.ForeignKey(name = "FK_NODE_LAST_MODIFIED_BY_USER_ID")
protected User lastModifiedBy;
@Transient
1.4 +4 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/File.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: File.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/File.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- File.java 2 Apr 2007 18:25:05 -0000 1.3
+++ File.java 19 Apr 2007 18:36:11 -0000 1.4
@@ -9,6 +9,10 @@
name = "NODE_FILE",
pkJoinColumns = @PrimaryKeyJoinColumn(name = "FILE_ID")
)
+ at org.hibernate.annotations.Table(
+ appliesTo = "NODE_FILE",
+ foreignKey = @org.hibernate.annotations.ForeignKey(name = "FK_NODE_FILE_FILE_ID")
+)
public class File extends Node {
@Column(table = "NODE_FILE", name = "FILENAME", length = 255, nullable = false)
1.3 +2 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Feed.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Feed.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Feed.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- Feed.java 19 Apr 2007 14:58:32 -0000 1.2
+++ Feed.java 19 Apr 2007 18:36:11 -0000 1.3
@@ -34,6 +34,8 @@
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "DIRECTORY_ID", nullable = false, updatable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_FEED_DIRECTORY_ID")
+ @org.hibernate.annotations.OnDelete(action = org.hibernate.annotations.OnDeleteAction.CASCADE)
private Directory directory;
public Feed() { }
1.7 +3 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/User.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: User.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/User.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- User.java 19 Apr 2007 14:58:32 -0000 1.6
+++ User.java 19 Apr 2007 18:36:11 -0000 1.7
@@ -64,10 +64,12 @@
inverseJoinColumns = @JoinColumn(name = "ROLE_ID")
)
@OrderBy("accessLevel desc, displayName asc")
+ @org.hibernate.annotations.ForeignKey(name = "USER_ROLE_USER_ID", inverseName = "USER_ROLE_ROLE_ID")
private List<Role> roles = new ArrayList<Role>();
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
- @JoinColumn(name = "MEMBER_HOME_NODE_ID")
+ @JoinColumn(name = "MEMBER_HOME_NODE_ID", nullable = true)
+ @org.hibernate.annotations.ForeignKey(name = "FK_USER_MEMBER_HOME_NODE_ID")
private Directory memberHome;
public User() {}
1.5 +2 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Directory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Directory.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Directory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Directory.java 8 Apr 2007 15:10:36 -0000 1.4
+++ Directory.java 19 Apr 2007 18:36:11 -0000 1.5
@@ -8,9 +8,10 @@
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
@JoinColumn(name = "DEFAULT_DOCUMENT_ID", nullable = true)
+ @org.hibernate.annotations.ForeignKey(name = "FK_DIRECTORY_DEFAULT_DOCUMENT_ID")
private Document defaultDocument;
- @OneToOne(mappedBy = "directory", cascade = CascadeType.PERSIST)
+ @OneToOne(fetch = FetchType.EAGER, mappedBy = "directory", cascade = CascadeType.PERSIST)
private Feed feed;
public Directory() { super("New Directory"); }
1.3 +2 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Comment.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Comment.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Comment.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- Comment.java 19 Apr 2007 14:58:32 -0000 1.2
+++ Comment.java 19 Apr 2007 18:36:11 -0000 1.3
@@ -24,6 +24,8 @@
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
@JoinColumn(name = "DOCUMENT_ID", nullable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_COMMENT_DOCUMENT_ID")
+ @org.hibernate.annotations.OnDelete(action = org.hibernate.annotations.OnDeleteAction.CASCADE)
private Document document;
@Column(name = "SUBJECT", nullable = false)
More information about the jboss-cvs-commits
mailing list