Many-To-Many Relationship across DB
Many-To-Many Relationship across DB
- Subject: Many-To-Many Relationship across DB
- From: Troy Lumasag <email@hidden>
- Date: Mon, 12 Mar 2012 17:58:23 +0800
Hello everyone,
I'm new to Webobjects and Wonder and I enjoy it a lot. I'm having a
simple insert problem.
My DB is Oracle and I have 2 Models(different User) .
My EOModel would look like this:
Model1
URL: jdbc:oracle:thin:@db.test:1521:oracletest
user:OracleConnect
Model2
URL: jdbc:oracle:thin:@db.test:1521:oracletest
user:Oracle
Now I have a Many-To-Many Relationship Teacher(Model1) <->
Student(Model2).
My Code would look like this:
public void save() {
EOEditingContext ec = (ERXEC) ERXEC.newEditingContext();
Teacher teacher = new Teacher();
ec.insertObject(teacher);
teacher.setName(teacherName);
Student student1 = new Student();
Student student2 = new Student();
ec.insertObject(student1);
ec.insertObject(student2);
student1.setName(studentName1);
student2.setName(studentName2);
teacher.addToStudentsRelationship(student1);
teacher.addToStudentsRelationship(student2);
ec.saveChanges();
}
I got this NPE everytime:
NullPointerException
at
com.webobjects.eoaccess.EODatabaseContext.primaryKeyForIntermediateRowFromSourceObject(EODatabaseContext.java:4845)
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:373)
at
com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192)
at er.extensions.eof.ERXEC._saveChanges(ERXEC.java:1094)
at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:1016)
at your.app.components.Main.save(Main.java:67)
Looks pretty simple but I'm stuck. Thank you in advance!
Regards,
Troy
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden