EJB programming & troubleshooting: which ejb create to use

  1. which ejb create to use (3 messages)

    i have a question regarding ejbcreate.

    we are using jbuilder to generate entity beans (cmp)

    it generated 2 ejbCreates

    ejbCreate(PrimaryKey pk)
    ejbCreate(all the columns in the database)

    which one would be the best to use.

    if i user the ejbCreate(PrimaryKey pk)
    does it create a rep. of the ejb then u set the
    setter methods. am i right in assuming this. but
    when does it get committed to the db???

    Threaded Messages (3)

  2. which ejb create to use[ Go to top ]

    It depends on what your business requirements are. What kind of constraints do you have on the table in your database. JBuilder generated those create methods more as an example of what you could use. Basically, you want to determine what data you absolutely need in the database and then pass those values into the create method. Make sure that the syntax of your create method is the same for the postcreate method.

    Hope this helps,

  3. which ejb create to use[ Go to top ]

    I think what Kent means in the last line of his reply is 'Signature' and not syntax of the ejbCreate() and ejbPostCreate() methods. In either case, I am used to saying 'make sure your ejbPostCrate() matches your ejbCreate()'. Kent seems to state the same in the reverse direction :-)

    - karthik
  4. which ejb create to use[ Go to top ]

    hi, michael!

    when the bean is commited to the db is the container's duty, and you should never care when it's done. therefore, put in your ejbCreate all attributes for which the db fields cannot be null AND you cannot provide a default value (neighter in ejbCreate, nor in the table description). and, of course, don't forget, to have this values set to satisfy your relationship constrains - if you have some ;-)