Just to clarify -- are you saying it's not possible to create the User instance without also creating a new Person instance? Maybe my example was not too clear. Let me re-explain:
I have a base class A with two subclasses, B1 and B2. I have already created an instance of B1 and stored it to the database, which means that an A record and a B1 record were inserted. I now want to create an instance of B2 that extends from the same A record as B1. Is this possible?
Thanks again.
Matt
[EMAIL PROTECTED] wrote:
Matt,
I believe since the Person and Student object exist it will set there values to null except the personId. Because in the User instance you are storing allthe other fields are null (if you set them to null when you declare them) except the loginName. So, ojb will know that person and student 001 exist and will do and update instead of an insert.
You should create them on the first store. Or do not have user extend Student, instead have a 1:1 relationship. Depends on your requirments i guess.
-chris worley
I'm trying to figure out how to store a new persisted object that extends a pre-existing object.
For example, I have 3 classes: Person, Student, and User. Student and User extend Person. A Student object already exists, and I now want to create a User object that inherits from the same Person as the Student object. Is this possible? Here's a code example:
User user = new User(); user.setLoginName("matt"); user.setPersonOid("001"); // A pre-existing person
broker.beginTransaction(); broker.store(user); broker.commitTransaction();
The result of the above code is a NEW empty person object being created with a newly generated OID (via a sequence). How can I associate the new User with a pre-existing Person?
Thanks again.
Matt
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
