Discussions

EJB programming & troubleshooting: ebj create problem

  1. ebj create problem (2 messages)

    question regarding ebjCreate/create

    i have:
    ebjCreate(String userId, int companyId, int i, String s)

    companyId is a foreign key in the user table. and i want to insert null into that field in the db. but the ejb inserts a 0 not a null and that violates the foreign key ref. how do i insert null instead of 0 ??

    thanks in advance.

    Threaded Messages (2)

  2. ebj create problem[ Go to top ]

    Something to try is to make companyId an Object that can accept a null value. Since you are using int, try Integer for companyId. What type of persistence are you using: BMP or CMP. You have alot more control of what happens here if you use BMP. For example, if you were using BMP, you could pass in the int value and test it for 0. If the value is 0, then send a null value to the database. What database are you using. Some databases are picky about how a field in the database is set to null.

    Kent
  3. ebj create problem[ Go to top ]

    hi kent,

    thanks for the reply. i'm going to try it. we are currently using oracle 8 with weblogic CMP. seems
    like more trouble than its worth.