Hello
I'm using the dvd-example and I tried to create two EntityBeans like Order and
OrderLine with a OneToMany Relationship.
anonymous wrote :
| @Entity
| @Name(bpath)
| @Scope(EVENT)
| public class Path implements Serializable{
|
| private int pathId;
| private String pathName;
| private List pathTerms = new ArrayList ();
|
| @Id @GeneratedValue
| @Column(name=PATHID)
| public int getPathId() {
| return pathId;
| }
| public void setPathId(int pathId) {
| this.pathId = pathId;
| }
|
| @NotNull
| public String getPathName() {
| return pathName;
| }
| public void setPathName(String pathName) {
| this.pathName = pathName;
| }
|
| @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy
=referPath)
| @JoinColumn (name = PATHID)
| public List getPathTerms() {
| return pathTerms;
| }
| public void setPathTerms(List pathTerms) {
| this.pathTerms = pathTerms;
| }
|
|
| public void addPathTerm(String text) {
| if (pathTerms == null)
| pathTerms = new ArrayList();
|
| PathTerm pathTerm = new PathTerm();
| pathTerm.setText(text);
| pathTerm.setReferPath(this);
|
| pathTerms.add(pathTerm);
| }
|
| }
anonymous wrote :
| @Entity
| @Name(pathterm)
| public class PathTerm implements Serializable {
|
| int pathTermId;
| int frequency;
| int totalNumber;
| String text;
| String dfrequency;
| Path referPath;
|
|
| @Id @GeneratedValue
| @Column(name=PATHTERMID)
| public int getPathTermId() {
| return pathTermId;
| }
| public void setPathTermId(int pathTermId) {
| this.pathTermId = pathTermId;
| }
|
|
| public String getDfrequency() {
| return dfrequency;
| }
| public void setDfrequency(String dfrequency) {
| this.dfrequency = dfrequency;
| }
|
|
| public int getFrequency() {
| return frequency;
| }
| public void setFrequency(int frequency) {
| this.frequency = frequency;
| }
|
|
| @ManyToOne
| @JoinColumn (name = PATHID)
| public Path getReferPath() {
| return referPath;
| }
| public void setReferPath(Path referPath) {
| this.referPath = referPath;
| }
|
| public int getTotalNumber() {
| return totalNumber;
| }
| public void setTotalNumber(int totalNumber) {
| this.totalNumber = totalNumber;
| }
| public String getText() {
| return text;
| }
| public void setText(String text) {
| this.text = text;
| }
|
| }
|
|
Furthermore I use the import file with these two statements
anonymous wrote : insert into PATH (PATHID, PATHNAME) VALUES (1, 'PATH 1')
| insert into PATHTERM (PATHTERMID, PATHID, TEXT, FREQUENCY, DFREQUENCY,
TOTALNUMBER) VALUES (1, 1, 'myText', 2, 'anotherText', 3)
I get this exception and have no idea, what's wrong
anonymous wrote : Caused by: java.sql.SQLException: Integrity constraint
violation FKD5F177D4B4327F2A table: TERMINE
| at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
| at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
| at org.hsqldb.jdbc.jdbcStatement.execute(Unknown Source)
| at
org.jboss.resource.adapter.jdbc.WrappedStatement.execute(WrappedStatement.java:82)
| at
org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:251)
|
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=3925625#3925625
Reply to the post :
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3925625
---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user