entity bean life cycle is confusing ???

Discussions

EJB design: entity bean life cycle is confusing ???

  1. entity bean life cycle is confusing ??? (4 messages)

    according to what most documents say about entity beans, the container creates an instance by newInstance() and then the instance is available in the pool. ejbfind() does not need the instance to be in ready state. an instance to goes into ready by ejbcreate() or ejbactivate(). Business methods can be called when in ready state.

    I am speaking in the context of BMP
    Now my doubt is

    If i want manipulate an already existing row of the database without create() ( because create means to insert a row in the database as entity beans are a view into the database ) what do i do. how do i get the bean to ready state and use my business methods to work on it.

    I had written a program where there was a ejbcreate() which did only initialization of some fields. ejbfindbyprimary to select a row and store results in the fields.a business method getName() to return the field name.
    I got TransactionRequired exception at create() say that bean construction requires a transaction context.

    please clarify.
  2. entity bean life cycle is confusing ???[ Go to top ]

    Hi U must be calling ur BMP bean from a Simple Java client.If this is the case then u need to handle the Transaction using JTA.
    Or else if u do the same from Stateless Session bean i think u should not get such exception because transaction will be handled by the container.
  3. entity bean life cycle is confusing ???[ Go to top ]

    My client is a servlet. do u still need to use JTA.

    thanx for the reply
    prithvi

  4. entity bean life cycle is confusing ???[ Go to top ]

    I believe you must have defaulted the bean transaction attribute type to either TX_SUPPORTS or something that has not instantiated a transaction.

    Note: TX_SUPPORTS uses the caller's Transaction thread.

    Please change to what your logic requires and you should be okay.

    Ajeet Koru

  5. entity bean life cycle is confusing ???[ Go to top ]

    I have given TX_SUPPORTS attribute in my CMP and it works just fine when i call it from simple java Client.