facebook

What now? Consequences of using an unknown primary key

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #237470 Reply

    JimOHearn
    Member

    For type safety I am using a custom primary key class. I’ve got the XML that I expect but there are a few issues I’d like to iron out:

    1) What does my finder method look like now? The CMP field that I used to have (“ID”) has been replaced by the unknown primary key: it specifies a field name = “ID” and a column name = C_ID”. What does my “findByID()” finder look like now? The same?

    ex. (old) — Select OBJECT(x) FROM tComponent AS x WHERE x.ID = ?1

    Should I use x.C_ID instead?

    2) Do I still need a getPrimaryKey() method? If so, how do I build the primary key class instance in the method without the old cmp field to refer to?

    old code:

    public Object getPrimaryKey() {
    ComponentPK key = new ComponentIntegerPK();
    key.ID = getID();
    return key;
    }

    There is no longer a getID() method because the CMP field “ID” no longer exists. What do I use for a value to assign to “key.ID”?

    By the way, is there anything else I’ve missed?

    I appreciate any input very much.

    Environment:

    Windows XP Professional
    MyEclipse 3.8.4
    JBoss 4.0.2
    Hypersonic DB

    #237537 Reply

    Riyad Kalla
    Member

    I’ll kick this to our resident EJB guy, if he has time he may reply, no promises, we are swamped over here.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: What now? Consequences of using an unknown primary key

You must be logged in to post in the forum log in