Hello Alexis,

Thank you.
cross models flattened many-to-many relationships with differents users are buggy in my experience.
You should use the same user in all your connection dictionnaries, easely done with Wonder in your Properties :
It needs to use different users :-P It looks like since the JDBC URL is the same, WebObjects is assuming that the two databases are the same, even though Oracle treats them differently since the user names are different.
At the db level you should make sure the "Oracle" user has the needed rights on "OracleConnect" user.
I'll check if the needed rights are set.
Good luck

Alex

2012/3/12 Fabian Peters <lists.fab...@e-lumo.com>
Hello Troy,

Am 12.03.2012 um 10:58 schrieb Troy Lumasag:


Hello everyone,

I'm new to Webobjects and Wonder and I enjoy it a lot. I'm having a simple insert problem.

Welcome!

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) 

I've never used Oracle but the problem seems to be related to PK generation. I guess the first thing to check would be whether you set the "OraclePlugIn". You can set it in entity modeler (just put  "OraclePlugIn" where I have "PostgresqlPlugIn"):

 

cheers, Fabian


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      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/lists.fabian%40e-lumo.com

This email sent to lists.fab...@e-lumo.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/alexis.tual%40gmail.com

This email sent to alexis.t...@gmail.com




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/tlumasag%40gmail.com

This email sent to tluma...@gmail.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to