• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Usercoded database fails to generate PKs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Usercoded database fails to generate PKs


  • Subject: Usercoded database fails to generate PKs
  • From: Ian Joyner <email@hidden>
  • Date: Wed, 21 Jun 2006 17:28:58 +1000

Good evening Mr Phelps,

I have put a usercode and password on our database to restrict any kind of access beneath Enterprise Objects (eg, with OpenBaseManager, but this should be independent of any particular database). I have added code to the Application constructor to log the EOModels into this DB with the following code:

    public Application () {
        	super ();

NSMutableDictionary d = new NSMutableDictionary ();
d.takeValueForKey (Server_configuration.db_username, "username");
d.takeValueForKey (Server_configuration.db_password, "password");
d.takeValueForKey (Server_configuration.db_URL, "URL");
EOEditingContext ec = new EOEditingContext ();

try {
Enumeration e = EOModelGroup.defaultGroup ().models ().objectEnumerator ();

while (e.hasMoreElements ()) {
EODatabaseContext.forceConnectionWithModel ((EOModel) e.nextElement (), d, ec);
}
} catch (Exception x) {
log.fatal ("Problem connecting to database. Reason: " + x.getMessage ());
System.exit (99);
}
}


This sets the connection for each model to the DB, but I actually only see two connection messages:

2006-06-21 17:23:46,900 DEBUG main NSLog (ERXNSLogLog4jBridge.java:appendln:44) - connecting with dictionary: {plugin = ""; username = "admin"; driver = ""; password = "<password deleted for log>"; URL = "jdbc:openbase://127.0.0.1/CronusIII:wo"; }

If I insert any entity into this DB, I should get:

2006-06-21 16:51:27,818 DEBUG WorkerThread1 NSLog (ERXNSLogLog4jBridge.java:appendln:44) - evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "INSERT INTO PERSON(PRIMARY_KEY, GENDER_KEY, PERSON_TYPE_KEY, DATE_OF_BIRTH, TERMINATION_DATE, UNIQUE_ID, CREATION_DATE, ALIAS, MODIFICATION_DATE, IS_A_DOCTOR, TYPE, FIRST_NAME, TITLE_KEY, IS_A_MANAGER, SURNAME, MIDDLE_NAMES) VALUES (?, ?, ?, NULL, NULL, NULL, ?, NULL, ?, ?, ?, ?, ?, ?, ?, NULL)" withBindings: 1:573 (NeededByEOF0), 2:6(gender_key), 3:11(person_type_key), 4:2006-06-21 16:51:27(creation_date), 5:2006-06-21 16:51:27(modification_date), 6:"F"(is_a_doctor), 7:"M"(type), 8:"Aaaad"(first_name), 9:1 (title_key), 10:"F"(is_a_manager), 11:"Aaaad"(surname)>

but instead I get an INSERT without a primary_key:

2006-06-21 16:54:25,805 DEBUG WorkerThread14 NSLog (ERXNSLogLog4jBridge.java:appendln:44) - evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "INSERT INTO PERSON(GENDER_KEY, PERSON_TYPE_KEY, DATE_OF_BIRTH, TERMINATION_DATE, UNIQUE_ID, CREATION_DATE, ALIAS, MODIFICATION_DATE, IS_A_DOCTOR, TYPE, FIRST_NAME, TITLE_KEY, IS_A_MANAGER, SURNAME, MIDDLE_NAMES) VALUES (?, ?, NULL, NULL, NULL, ?, NULL, ?, ?, ?, ?, ?, ?, ?, NULL)" withBindings: 1:6(gender_key), 2:11 (person_type_key), 3:2006-06-21 16:54:25(creation_date), 4:2006-06-21 16:54:25(modification_date), 5:"F"(is_a_doctor), 6:"M"(type), 7:"Aabb"(first_name), 8:1(title_key), 9:"F"(is_a_manager), 10:"Aabb"(surname)>
java.sql.SQLException: ERROR - Value can not be NULL for column 'PRIMARY_KEY'
SQL: INSERT INTO PERSON(GENDER_KEY, PERSON_TYPE_KEY, DATE_OF_BIRTH, TERMINATION_DATE, UNIQUE_ID, CREATION_DATE, ALIAS, MODIFICATION_DATE, IS_A_DOCTOR, TYPE, FIRST_NAME, TITLE_KEY, IS_A_MANAGER, SURNAME, MIDDLE_NAMES) VALUES (6, 11, NULL, NULL, NULL, 172565665.602, NULL, 172565665.602, 'F', 'M', 'Aabb', 1, 'F', 'Aabb', NULL)


Any thoughts as to what is preventing EO from generating the PKs?

Thanks
Ian Joyner
Sportstec
_______________________________________________
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


  • Follow-Ups:
    • Re: Usercoded database fails to generate PKs
      • From: Mike Schrag <email@hidden>
  • Prev by Date: Re: FrontBase and javaeoutil
  • Next by Date: AW: Usercoded database fails to generate PKs
  • Previous by thread: Re: Shared Editing Context Error
  • Next by thread: Re: Usercoded database fails to generate PKs
  • Index(es):
    • Date
    • Thread