Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How best to get sequence's nextval

3737Aug 25 2003 — edited Aug 26 2003
Hi ,

I have a situation where my domain objects use sequences(which the great toplink populates automatically), but my entity beans use CMP (Container and not Toplink ) and hence i have to provide them the ID's ( i use oracle sequences). I have eliminated all JDBC calls in my app and hence i don't want to write a JDBC call to get seq.nextval. Is there a way by which i can ask toplink to fetch the nextval of the sequence.

i tried the below code..., but it throws an exception stating Integer not found in project descriptor.
  public Integer getNextID(String seqName) 
      throws DatabaseException {
    ClientSession client = server.acquireClientSession();
    ReadObjectQuery query = new ReadObjectQuery(Integer.class);
    query.setSQLString(" SELECT "+seqName+".NEXTVAL FROM Dual");
    return (Integer)client.executeQuery(query);
  }
Regards
Elango.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 23 2003
Added on Aug 25 2003
2 comments
3,033 views