yes it is needed by almost all implementations backed by a RDBMS

you can "workaround" it if your business allows the usage of a
stateful + extended persistence context.

to lazy load a relationship you need an entity "parent" but if you
aren't in a transaction you are detached and then don't know if your
state is correct. I think that's the main reason (even if
implementation dependent)

Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2013/10/30 José Luis Cetina <[email protected]>:
> Sorry if i post here, i posted this some days ago, but in openjpa mailing
> list somethings you dont get answer's, i hope somebody can help.
>
>
> Hi, i have a problem, im changing my ejbs from
>
> @TransactionManagement(TransactionManagementType.BEAN)
>
> to
>
> @TransactionAttribute(TransactionAttributeType.REQUIRED)
> @TransactionManagement(TransactionManagementType.CONTAINER)
>
> My ejb methods that only performs read only querys are marked with
> @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) because they
> are read only, this works as expected. But when i try to fetch some
> properties from my entity that is marked as LAZY i could never retrieved
> because is null. If i mark my entity property (list) with EAGER or if i
> mark my method with
> @TransactionAttribute(TransactionAttributeType.REQUIRED) all works.
>
> So my question is, do i have to use a transaction for read only querys that
> need any kind of fetch, if yes, Why???

Reply via email to