persistence@glassfish.java.net

Re: Listeners Problems

From: Markus KARG <markus.karg_at_gmx.net>
Date: Tue, 29 Apr 2008 19:41:55 +0200

I see. I did not know that in EJB 3.0 I still can do JNDI lookups. I
always thought that this was replaced by injection. But today I learned
that the old stuff is still there. Great! :-)

Thanks a lot!
Markus

Marina Vatkina schrieb:
> You can doo lookup in the entity as in any other helper class. This is
> what I got from our EJB expert:
>
>
>> It doesn't matter if it is an entity AS LONG AS the entity operation
>> itself
>> was called from a component.
>>
>> For example, if FooBean is an EJB *and if it can do the jndi lookup
>> properly*, then the JPA entity also can do do the same lookup, as
>> long as the
>> EJB component is the "current" component in the calling stack.
>
> HTH,
> -marina
>
> Markus KARG wrote:
>> I am new to JPA and have some questions on correctly using listeners.
>>
>> I have an entity bean that shall do two things:
>>
>> (1) As soon as INSERT was done, its GeneratedValue ID shall be
>> written into
>> another data field. But if I try to modify any field inside of
>> @PostPersist,
>> those changes never occur in the database. Isn't it allowed to change an
>> object after it got persisted? Or am I the only one that needs to
>> have the
>> generated valued copied in another field?
>>
>> (2) As soon as INSERT was done, a JMS message shall be sent. But how
>> to obtain a JMS session inside of a EJB 3.0 entity (I knew how to do
>> it in EJB
>> 2.1)?
>>
>> I know I can workaround by modifying the calling code. But as I am
>> programming a third party library, my customers shall not be forced
>> to do all
>> those things manually in their calling code.
>>
>> Any ideas?
>>
>> Thanks Markus
>>
>


-- 
http://www.xing.com/go/invita/58469