Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

How to get an ID for an entity

  Asked By: Fabiana    Date: May 05    Category: Java    Views: 727

I am trying to write a simple swing form with ADF and here is my point:
1- Senario
I have three fields, ID, LastName and FirstName on the form. The ID
is disabled and it must get its value from the application when we
want to insert a new record. I do not want to use insert triggers or
sequence generators or stored procedures, So i have to read the max id
and increment it by one from inside the application.
2- Questions
- Where is the appropriate position for getting the max Id? Entity
object? View Object? Application Module or Swing form?
- ADF gives us the create() method in Entity object and it defines
it for having initial values for attributes, like what i need, but the
question is how do i have to read the max id from inside this method?
Do i have to execute a select statement? if so how? do i have to
define another view object wich reads the max id? and in this case,
how do i have to access this view object from inside another Entity
Object? Is it generaly OK to access a view object from inside an
Entity object?



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on How to get an ID for an entity Or get search suggestion and latest updates.