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.