Hi,

        What is the right way to create one object if that isnt into database
yet? Maybe i shouldnt get advantage of know about the first generated
id, 1. Im using MAX key-generator. I dit try:

    try {
        accRoot = (Account) db.load(Account.class, new Integer(1));
    } catch(ObjectNotFoundException e) {
        accRoot = new Account("FirstAccount");
        db.create(accRoot);
    }

And got following exception:

[account] Castor: Creating com.bigbross.account.Account (null)
org.exolab.castor.jdo.LockNotGrantedException: Lock is already existed
for the new oid.
        at org.exolab.castor.persist.LockEngine$TypeInfo.rename(Unknown
Source)

<skip>...</skip>

org.exolab.castor.jdo.PersistenceException: Nested error: Key Generator
Failure. Duplicated Identity is generated!
        at org.exolab.castor.persist.LockEngine.create(Unknown Source)


---
Thanks!

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to