You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Thomas Frühbeck <fr...@aon.at> on 2014/12/15 23:47:42 UTC

Data module and serializability in cluster w/ distributable session

Hi,

we are integrating Data module of DS as vital part of our persistence 
layer, but unfortunately Repositories are not Serializable, so that SFSB 
or SessionScoped beans with Dependent scoped dependencies on 
Repositories will fail in cluster configurations.

Due to some recent overuse of scoped dependencies we would like to 
refrain from again starting to scope vital infrastructure.

Can you give some advice, which way to solve this problem?

Many thanks for your dedication to DeltaSpike and your help,
Thomas

Re: Data module and serializability in cluster w/ distributable session

Posted by Thomas Andraschko <an...@gmail.com>.
Hi,

i would make your repositories AppScoped.
Unfortunately AppScoped doesn't work for abstract repositories :/ I still
have the same problem ->
https://issues.apache.org/jira/browse/DELTASPIKE-647


2014-12-15 23:47 GMT+01:00 Thomas Frühbeck <fr...@aon.at>:
>
> Hi,
>
> we are integrating Data module of DS as vital part of our persistence
> layer, but unfortunately Repositories are not Serializable, so that SFSB or
> SessionScoped beans with Dependent scoped dependencies on Repositories will
> fail in cluster configurations.
>
> Due to some recent overuse of scoped dependencies we would like to refrain
> from again starting to scope vital infrastructure.
>
> Can you give some advice, which way to solve this problem?
>
> Many thanks for your dedication to DeltaSpike and your help,
> Thomas
>

Re: Data module and serializability in cluster w/ distributable session

Posted by Thomas Andraschko <an...@gmail.com>.
Nothing, works perfectly fine.
We have just a bug in our partial bean module if the repo is abstract.
Interfaces are working fine.
Nevertheless, most of my repositories are abstract...

2014-12-16 15:41 GMT+01:00 Karl Kildén <ka...@gmail.com>:
>
> Whats the drawback for @ApplicationScoped eg.
>
> @Repository
> @ApplicationScoped
> public interface UserRepository extends EntityRepository<User, Long> {
>
> User findOptionalByUsernameEqual(String username);
> }
>
> On 16 December 2014 at 14:23, Thomas Andraschko <
> andraschko.thomas@gmail.com
> > wrote:
> >
> > :D
> >
> > IMO it also doesn't make sense to serialize repositories!
> >
> > 2014-12-16 14:16 GMT+01:00 Thomas Hug <th...@gmail.com>:
> > >
> > > Officially declaring this the "Thomas" thread ;-)
> > >
> > > Agree with Thomas that going for AppScope is probably the simplest
> > > workaround for now. I remember some efforts for serialization (as OWB
> > > complained for some cases) but overall it does not work well when you
> > have
> > > to inject EMs or use Instance<>. Fixing this properly might require a
> > major
> > > refactoring.
> > >
> > > On Tue, Dec 16, 2014 at 8:17 AM, Thomas Andraschko <
> > > andraschko.thomas@gmail.com> wrote:
> > > >
> > > > Hi,
> > > >
> > > > i would make your repositories AppScoped.
> > > > Unfortunately AppScoped doesn't work for abstract repositories :/ I
> > still
> > > > have the same problem ->
> > > > https://issues.apache.org/jira/browse/DELTASPIKE-647
> > > >
> > > >
> > > > 2014-12-15 23:47 GMT+01:00 Thomas Frühbeck <fr...@aon.at>:
> > > > >
> > > > > Hi,
> > > > >
> > > > > we are integrating Data module of DS as vital part of our
> persistence
> > > > > layer, but unfortunately Repositories are not Serializable, so that
> > > SFSB
> > > > or
> > > > > SessionScoped beans with Dependent scoped dependencies on
> > Repositories
> > > > will
> > > > > fail in cluster configurations.
> > > > >
> > > > > Due to some recent overuse of scoped dependencies we would like to
> > > > refrain
> > > > > from again starting to scope vital infrastructure.
> > > > >
> > > > > Can you give some advice, which way to solve this problem?
> > > > >
> > > > > Many thanks for your dedication to DeltaSpike and your help,
> > > > > Thomas
> > > > >
> > > >
> > >
> >
>

Re: Data module and serializability in cluster w/ distributable session

Posted by Karl Kildén <ka...@gmail.com>.
For now I use just the interface and @Stateless not @AppScoped, should be
okay? I really need to try clustering soon...

Thanks for the data module I really like it - hope the issue can be resolved

cheers

On 16 December 2014 at 20:58, Thomas Hug <th...@gmail.com> wrote:
>
> AFAIR it's not abstract repositories per se, it's the combination of an
> abstract class extending an abstract class implementing an interface which
> is somehow broken (took me ages to find that case and bounce the issue back
> to PartialBeans). Which is what you get extending AbstractEntityRepository.
>
> => You can skip AbstractEntityRepository, implement EntityRepository
> directly and get the EM injected. Umm, haven't tried that actually but
> stating it boldly here ;-)
>
> For the drawback, AppScope should definitely work fine (only some people
> react allergic to proxies ;-).
>
> On Tue, Dec 16, 2014 at 3:45 PM, Thomas Andraschko <
> andraschko.thomas@gmail.com> wrote:
> >
> > Nothing, works perfectly fine.
> > We have just a bug in our partial bean module if the repo is abstract.
> > Interfaces are working fine.
> > Nevertheless, most of my repositories are abstract...
> >
> > 2014-12-16 15:41 GMT+01:00 Karl Kildén <ka...@gmail.com>:
> > >
> > > Whats the drawback for @ApplicationScoped eg.
> > >
> > > @Repository
> > > @ApplicationScoped
> > > public interface UserRepository extends EntityRepository<User, Long> {
> > >
> > > User findOptionalByUsernameEqual(String username);
> > > }
> > >
> > > On 16 December 2014 at 14:23, Thomas Andraschko <
> > > andraschko.thomas@gmail.com
> > > > wrote:
> > > >
> > > > :D
> > > >
> > > > IMO it also doesn't make sense to serialize repositories!
> > > >
> > > > 2014-12-16 14:16 GMT+01:00 Thomas Hug <th...@gmail.com>:
> > > > >
> > > > > Officially declaring this the "Thomas" thread ;-)
> > > > >
> > > > > Agree with Thomas that going for AppScope is probably the simplest
> > > > > workaround for now. I remember some efforts for serialization (as
> OWB
> > > > > complained for some cases) but overall it does not work well when
> you
> > > > have
> > > > > to inject EMs or use Instance<>. Fixing this properly might
> require a
> > > > major
> > > > > refactoring.
> > > > >
> > > > > On Tue, Dec 16, 2014 at 8:17 AM, Thomas Andraschko <
> > > > > andraschko.thomas@gmail.com> wrote:
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > i would make your repositories AppScoped.
> > > > > > Unfortunately AppScoped doesn't work for abstract repositories
> :/ I
> > > > still
> > > > > > have the same problem ->
> > > > > > https://issues.apache.org/jira/browse/DELTASPIKE-647
> > > > > >
> > > > > >
> > > > > > 2014-12-15 23:47 GMT+01:00 Thomas Frühbeck <fr...@aon.at>:
> > > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > we are integrating Data module of DS as vital part of our
> > > persistence
> > > > > > > layer, but unfortunately Repositories are not Serializable, so
> > that
> > > > > SFSB
> > > > > > or
> > > > > > > SessionScoped beans with Dependent scoped dependencies on
> > > > Repositories
> > > > > > will
> > > > > > > fail in cluster configurations.
> > > > > > >
> > > > > > > Due to some recent overuse of scoped dependencies we would like
> > to
> > > > > > refrain
> > > > > > > from again starting to scope vital infrastructure.
> > > > > > >
> > > > > > > Can you give some advice, which way to solve this problem?
> > > > > > >
> > > > > > > Many thanks for your dedication to DeltaSpike and your help,
> > > > > > > Thomas
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: Data module and serializability in cluster w/ distributable session

Posted by Thomas Frühbeck <fr...@aon.at>.
a short follow up to proposed solution @ApplicationScoped EntityRepository:

- SLSB does _not_ work same way as @Dependent scoped EntityRepo
  -- yes, serialization and injection work
  -- but entities are detached, all entity relationships are broken when 
leaving SLSB (hmm, well, it's called _stateless_, in glaring contrast to 
a _stateful_ persistence context so I shouldn't have been surprised 
first place)
So SLSB introduces quite some impact on complexity of business logic in 
UI Beans when using more elaborate entity relations and lazy loading
(I didn't investigate overhead - there is for sure some impact)

- @ApplicationScoped works as far as I had time to test in a rather 
relation-heavy application
  -- AbstractEntityRepo has to be _removed_
  -- and replaced by injected EntityMangerResolver
  --- we use the same as registered in 
@EntityMangerConfig#entityManagerResolver,
  --- which will get EM injected by the application's EM-Provider

Now our repos look like:

@ApplicationScoped
@Repository
@EntityManagerConfig(entityManagerResolver = 
CsmsEntityManagerResolver.class)
public abstract class MessageRepository implements 
EntityRepository<Message, Long> {

     @Inject
     private CsmsEntityManagerResolver resolver;

     Message bySomeLogic() {
         EntityManger em = resolver.resolveEntityManager();
         <some very complicated qery :-) >
     }
}

Humble questions to the experts: AFAIKS there may be the possibility, 
that a underlying repo impl gets injected an EM, which is different from 
the EM being injected into our business repos. E.g. due to different 
stages of query processing.

What do you think?

What could/shoule we do about it?


Am 17.12.2014 um 00:41 schrieb Thomas Frühbeck:
> Thank you all for confirming the approach using @ApplicationScoped.
>
> @Karl thanks for the "wrapping techinque", an interesting twist I hope 
> to investigate a bit :-)
>
> Best regards,
> Thomas
>
> Am 16.12.2014 um 22:20 schrieb Karl Kildén:
>> Sorry that's not what I meant. I use the "wrapping technique". A 
>> @Stateless
>>   and I inject the repositories in it. My repositories are just from the
>> minimal example ie. no scopes, but maybe they should be 
>> @ApplicationScoped
>> I don't know the pros and cons.
>>
>>
>> On 16 December 2014 at 21:28, Thomas Hug <th...@gmail.com> wrote:
>>> Glad to hear :-)
>>> I'd be surprised if @Stateless has any effect?
>>>
>>> On Tue, Dec 16, 2014 at 9:07 PM, Karl Kildén <ka...@gmail.com>
>>> wrote:
>>>> For now I use just the interface and @Stateless not @AppScoped, 
>>>> should be
>>>> okay? I really need to try clustering soon...
>>>>
>>>> Thanks for the data module I really like it - hope the issue can be
>>>> resolved
>>>>
>>>> cheers
>>>>
>>>> On 16 December 2014 at 20:58, Thomas Hug <th...@gmail.com> wrote:
>>>>> AFAIR it's not abstract repositories per se, it's the combination 
>>>>> of an
>>>>> abstract class extending an abstract class implementing an interface
>>>> which
>>>>> is somehow broken (took me ages to find that case and bounce the 
>>>>> issue
>>>> back
>>>>> to PartialBeans). Which is what you get extending
>>>> AbstractEntityRepository.
>>>>> => You can skip AbstractEntityRepository, implement EntityRepository
>>>>> directly and get the EM injected. Umm, haven't tried that actually 
>>>>> but
>>>>> stating it boldly here ;-)
>>>>>
>>>>> For the drawback, AppScope should definitely work fine (only some
>>> people
>>>>> react allergic to proxies ;-).
>>>>>
>>>>> On Tue, Dec 16, 2014 at 3:45 PM, Thomas Andraschko <
>>>>> andraschko.thomas@gmail.com> wrote:
>>>>>> Nothing, works perfectly fine.
>>>>>> We have just a bug in our partial bean module if the repo is
>>> abstract.
>>>>>> Interfaces are working fine.
>>>>>> Nevertheless, most of my repositories are abstract...
>>>>>>
>>>>>> 2014-12-16 15:41 GMT+01:00 Karl Kildén <ka...@gmail.com>:
>>>>>>> Whats the drawback for @ApplicationScoped eg.
>>>>>>>
>>>>>>> @Repository
>>>>>>> @ApplicationScoped
>>>>>>> public interface UserRepository extends EntityRepository<User,
>>> Long>
>>>> {
>>>>>>> User findOptionalByUsernameEqual(String username);
>>>>>>> }
>>>>>>>
>>>>>>> On 16 December 2014 at 14:23, Thomas Andraschko <
>>>>>>> andraschko.thomas@gmail.com
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> :D
>>>>>>>>
>>>>>>>> IMO it also doesn't make sense to serialize repositories!
>>>>>>>>
>>>>>>>> 2014-12-16 14:16 GMT+01:00 Thomas Hug <th...@gmail.com>:
>>>>>>>>> Officially declaring this the "Thomas" thread ;-)
>>>>>>>>>
>>>>>>>>> Agree with Thomas that going for AppScope is probably the
>>>> simplest
>>>>>>>>> workaround for now. I remember some efforts for serialization
>>> (as
>>>>> OWB
>>>>>>>>> complained for some cases) but overall it does not work well
>>> when
>>>>> you
>>>>>>>> have
>>>>>>>>> to inject EMs or use Instance<>. Fixing this properly might
>>>>> require a
>>>>>>>> major
>>>>>>>>> refactoring.
>>>>>>>>>
>>>>>>>>> On Tue, Dec 16, 2014 at 8:17 AM, Thomas Andraschko <
>>>>>>>>> andraschko.thomas@gmail.com> wrote:
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> i would make your repositories AppScoped.
>>>>>>>>>> Unfortunately AppScoped doesn't work for abstract
>>> repositories
>>>>> :/ I
>>>>>>>> still
>>>>>>>>>> have the same problem ->
>>>>>>>>>> https://issues.apache.org/jira/browse/DELTASPIKE-647
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 2014-12-15 23:47 GMT+01:00 Thomas Frühbeck <fruehbeck@aon.at
>>>> :
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> we are integrating Data module of DS as vital part of our
>>>>>>> persistence
>>>>>>>>>>> layer, but unfortunately Repositories are not Serializable,
>>>> so
>>>>>> that
>>>>>>>>> SFSB
>>>>>>>>>> or
>>>>>>>>>>> SessionScoped beans with Dependent scoped dependencies on
>>>>>>>> Repositories
>>>>>>>>>> will
>>>>>>>>>>> fail in cluster configurations.
>>>>>>>>>>>
>>>>>>>>>>> Due to some recent overuse of scoped dependencies we would
>>>> like
>>>>>> to
>>>>>>>>>> refrain
>>>>>>>>>>> from again starting to scope vital infrastructure.
>>>>>>>>>>>
>>>>>>>>>>> Can you give some advice, which way to solve this problem?
>>>>>>>>>>>
>>>>>>>>>>> Many thanks for your dedication to DeltaSpike and your
>>> help,
>>>>>>>>>>> Thomas
>>>>>>>>>>>
>
>


Re: Data module and serializability in cluster w/ distributable session

Posted by Thomas Frühbeck <fr...@aon.at>.
Thank you all for confirming the approach using @ApplicationScoped.

@Karl thanks for the "wrapping techinque", an interesting twist I hope 
to investigate a bit :-)

Best regards,
Thomas

Am 16.12.2014 um 22:20 schrieb Karl Kildén:
> Sorry that's not what I meant. I use the "wrapping technique". A @Stateless
>   and I inject the repositories in it. My repositories are just from the
> minimal example ie. no scopes, but maybe they should be @ApplicationScoped
> I don't know the pros and cons.
>
>
> On 16 December 2014 at 21:28, Thomas Hug <th...@gmail.com> wrote:
>> Glad to hear :-)
>> I'd be surprised if @Stateless has any effect?
>>
>> On Tue, Dec 16, 2014 at 9:07 PM, Karl Kildén <ka...@gmail.com>
>> wrote:
>>> For now I use just the interface and @Stateless not @AppScoped, should be
>>> okay? I really need to try clustering soon...
>>>
>>> Thanks for the data module I really like it - hope the issue can be
>>> resolved
>>>
>>> cheers
>>>
>>> On 16 December 2014 at 20:58, Thomas Hug <th...@gmail.com> wrote:
>>>> AFAIR it's not abstract repositories per se, it's the combination of an
>>>> abstract class extending an abstract class implementing an interface
>>> which
>>>> is somehow broken (took me ages to find that case and bounce the issue
>>> back
>>>> to PartialBeans). Which is what you get extending
>>> AbstractEntityRepository.
>>>> => You can skip AbstractEntityRepository, implement EntityRepository
>>>> directly and get the EM injected. Umm, haven't tried that actually but
>>>> stating it boldly here ;-)
>>>>
>>>> For the drawback, AppScope should definitely work fine (only some
>> people
>>>> react allergic to proxies ;-).
>>>>
>>>> On Tue, Dec 16, 2014 at 3:45 PM, Thomas Andraschko <
>>>> andraschko.thomas@gmail.com> wrote:
>>>>> Nothing, works perfectly fine.
>>>>> We have just a bug in our partial bean module if the repo is
>> abstract.
>>>>> Interfaces are working fine.
>>>>> Nevertheless, most of my repositories are abstract...
>>>>>
>>>>> 2014-12-16 15:41 GMT+01:00 Karl Kildén <ka...@gmail.com>:
>>>>>> Whats the drawback for @ApplicationScoped eg.
>>>>>>
>>>>>> @Repository
>>>>>> @ApplicationScoped
>>>>>> public interface UserRepository extends EntityRepository<User,
>> Long>
>>> {
>>>>>> User findOptionalByUsernameEqual(String username);
>>>>>> }
>>>>>>
>>>>>> On 16 December 2014 at 14:23, Thomas Andraschko <
>>>>>> andraschko.thomas@gmail.com
>>>>>>> wrote:
>>>>>>>
>>>>>>> :D
>>>>>>>
>>>>>>> IMO it also doesn't make sense to serialize repositories!
>>>>>>>
>>>>>>> 2014-12-16 14:16 GMT+01:00 Thomas Hug <th...@gmail.com>:
>>>>>>>> Officially declaring this the "Thomas" thread ;-)
>>>>>>>>
>>>>>>>> Agree with Thomas that going for AppScope is probably the
>>> simplest
>>>>>>>> workaround for now. I remember some efforts for serialization
>> (as
>>>> OWB
>>>>>>>> complained for some cases) but overall it does not work well
>> when
>>>> you
>>>>>>> have
>>>>>>>> to inject EMs or use Instance<>. Fixing this properly might
>>>> require a
>>>>>>> major
>>>>>>>> refactoring.
>>>>>>>>
>>>>>>>> On Tue, Dec 16, 2014 at 8:17 AM, Thomas Andraschko <
>>>>>>>> andraschko.thomas@gmail.com> wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> i would make your repositories AppScoped.
>>>>>>>>> Unfortunately AppScoped doesn't work for abstract
>> repositories
>>>> :/ I
>>>>>>> still
>>>>>>>>> have the same problem ->
>>>>>>>>> https://issues.apache.org/jira/browse/DELTASPIKE-647
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 2014-12-15 23:47 GMT+01:00 Thomas Frühbeck <fruehbeck@aon.at
>>> :
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> we are integrating Data module of DS as vital part of our
>>>>>> persistence
>>>>>>>>>> layer, but unfortunately Repositories are not Serializable,
>>> so
>>>>> that
>>>>>>>> SFSB
>>>>>>>>> or
>>>>>>>>>> SessionScoped beans with Dependent scoped dependencies on
>>>>>>> Repositories
>>>>>>>>> will
>>>>>>>>>> fail in cluster configurations.
>>>>>>>>>>
>>>>>>>>>> Due to some recent overuse of scoped dependencies we would
>>> like
>>>>> to
>>>>>>>>> refrain
>>>>>>>>>> from again starting to scope vital infrastructure.
>>>>>>>>>>
>>>>>>>>>> Can you give some advice, which way to solve this problem?
>>>>>>>>>>
>>>>>>>>>> Many thanks for your dedication to DeltaSpike and your
>> help,
>>>>>>>>>> Thomas
>>>>>>>>>>


Re: Data module and serializability in cluster w/ distributable session

Posted by Karl Kildén <ka...@gmail.com>.
Sorry that's not what I meant. I use the "wrapping technique". A @Stateless
 and I inject the repositories in it. My repositories are just from the
minimal example ie. no scopes, but maybe they should be @ApplicationScoped
I don't know the pros and cons.


On 16 December 2014 at 21:28, Thomas Hug <th...@gmail.com> wrote:
>
> Glad to hear :-)
> I'd be surprised if @Stateless has any effect?
>
> On Tue, Dec 16, 2014 at 9:07 PM, Karl Kildén <ka...@gmail.com>
> wrote:
> >
> > For now I use just the interface and @Stateless not @AppScoped, should be
> > okay? I really need to try clustering soon...
> >
> > Thanks for the data module I really like it - hope the issue can be
> > resolved
> >
> > cheers
> >
> > On 16 December 2014 at 20:58, Thomas Hug <th...@gmail.com> wrote:
> > >
> > > AFAIR it's not abstract repositories per se, it's the combination of an
> > > abstract class extending an abstract class implementing an interface
> > which
> > > is somehow broken (took me ages to find that case and bounce the issue
> > back
> > > to PartialBeans). Which is what you get extending
> > AbstractEntityRepository.
> > >
> > > => You can skip AbstractEntityRepository, implement EntityRepository
> > > directly and get the EM injected. Umm, haven't tried that actually but
> > > stating it boldly here ;-)
> > >
> > > For the drawback, AppScope should definitely work fine (only some
> people
> > > react allergic to proxies ;-).
> > >
> > > On Tue, Dec 16, 2014 at 3:45 PM, Thomas Andraschko <
> > > andraschko.thomas@gmail.com> wrote:
> > > >
> > > > Nothing, works perfectly fine.
> > > > We have just a bug in our partial bean module if the repo is
> abstract.
> > > > Interfaces are working fine.
> > > > Nevertheless, most of my repositories are abstract...
> > > >
> > > > 2014-12-16 15:41 GMT+01:00 Karl Kildén <ka...@gmail.com>:
> > > > >
> > > > > Whats the drawback for @ApplicationScoped eg.
> > > > >
> > > > > @Repository
> > > > > @ApplicationScoped
> > > > > public interface UserRepository extends EntityRepository<User,
> Long>
> > {
> > > > >
> > > > > User findOptionalByUsernameEqual(String username);
> > > > > }
> > > > >
> > > > > On 16 December 2014 at 14:23, Thomas Andraschko <
> > > > > andraschko.thomas@gmail.com
> > > > > > wrote:
> > > > > >
> > > > > > :D
> > > > > >
> > > > > > IMO it also doesn't make sense to serialize repositories!
> > > > > >
> > > > > > 2014-12-16 14:16 GMT+01:00 Thomas Hug <th...@gmail.com>:
> > > > > > >
> > > > > > > Officially declaring this the "Thomas" thread ;-)
> > > > > > >
> > > > > > > Agree with Thomas that going for AppScope is probably the
> > simplest
> > > > > > > workaround for now. I remember some efforts for serialization
> (as
> > > OWB
> > > > > > > complained for some cases) but overall it does not work well
> when
> > > you
> > > > > > have
> > > > > > > to inject EMs or use Instance<>. Fixing this properly might
> > > require a
> > > > > > major
> > > > > > > refactoring.
> > > > > > >
> > > > > > > On Tue, Dec 16, 2014 at 8:17 AM, Thomas Andraschko <
> > > > > > > andraschko.thomas@gmail.com> wrote:
> > > > > > > >
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > i would make your repositories AppScoped.
> > > > > > > > Unfortunately AppScoped doesn't work for abstract
> repositories
> > > :/ I
> > > > > > still
> > > > > > > > have the same problem ->
> > > > > > > > https://issues.apache.org/jira/browse/DELTASPIKE-647
> > > > > > > >
> > > > > > > >
> > > > > > > > 2014-12-15 23:47 GMT+01:00 Thomas Frühbeck <fruehbeck@aon.at
> >:
> > > > > > > > >
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > we are integrating Data module of DS as vital part of our
> > > > > persistence
> > > > > > > > > layer, but unfortunately Repositories are not Serializable,
> > so
> > > > that
> > > > > > > SFSB
> > > > > > > > or
> > > > > > > > > SessionScoped beans with Dependent scoped dependencies on
> > > > > > Repositories
> > > > > > > > will
> > > > > > > > > fail in cluster configurations.
> > > > > > > > >
> > > > > > > > > Due to some recent overuse of scoped dependencies we would
> > like
> > > > to
> > > > > > > > refrain
> > > > > > > > > from again starting to scope vital infrastructure.
> > > > > > > > >
> > > > > > > > > Can you give some advice, which way to solve this problem?
> > > > > > > > >
> > > > > > > > > Many thanks for your dedication to DeltaSpike and your
> help,
> > > > > > > > > Thomas
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: Data module and serializability in cluster w/ distributable session

Posted by Thomas Hug <th...@gmail.com>.
Glad to hear :-)
I'd be surprised if @Stateless has any effect?

On Tue, Dec 16, 2014 at 9:07 PM, Karl Kildén <ka...@gmail.com> wrote:
>
> For now I use just the interface and @Stateless not @AppScoped, should be
> okay? I really need to try clustering soon...
>
> Thanks for the data module I really like it - hope the issue can be
> resolved
>
> cheers
>
> On 16 December 2014 at 20:58, Thomas Hug <th...@gmail.com> wrote:
> >
> > AFAIR it's not abstract repositories per se, it's the combination of an
> > abstract class extending an abstract class implementing an interface
> which
> > is somehow broken (took me ages to find that case and bounce the issue
> back
> > to PartialBeans). Which is what you get extending
> AbstractEntityRepository.
> >
> > => You can skip AbstractEntityRepository, implement EntityRepository
> > directly and get the EM injected. Umm, haven't tried that actually but
> > stating it boldly here ;-)
> >
> > For the drawback, AppScope should definitely work fine (only some people
> > react allergic to proxies ;-).
> >
> > On Tue, Dec 16, 2014 at 3:45 PM, Thomas Andraschko <
> > andraschko.thomas@gmail.com> wrote:
> > >
> > > Nothing, works perfectly fine.
> > > We have just a bug in our partial bean module if the repo is abstract.
> > > Interfaces are working fine.
> > > Nevertheless, most of my repositories are abstract...
> > >
> > > 2014-12-16 15:41 GMT+01:00 Karl Kildén <ka...@gmail.com>:
> > > >
> > > > Whats the drawback for @ApplicationScoped eg.
> > > >
> > > > @Repository
> > > > @ApplicationScoped
> > > > public interface UserRepository extends EntityRepository<User, Long>
> {
> > > >
> > > > User findOptionalByUsernameEqual(String username);
> > > > }
> > > >
> > > > On 16 December 2014 at 14:23, Thomas Andraschko <
> > > > andraschko.thomas@gmail.com
> > > > > wrote:
> > > > >
> > > > > :D
> > > > >
> > > > > IMO it also doesn't make sense to serialize repositories!
> > > > >
> > > > > 2014-12-16 14:16 GMT+01:00 Thomas Hug <th...@gmail.com>:
> > > > > >
> > > > > > Officially declaring this the "Thomas" thread ;-)
> > > > > >
> > > > > > Agree with Thomas that going for AppScope is probably the
> simplest
> > > > > > workaround for now. I remember some efforts for serialization (as
> > OWB
> > > > > > complained for some cases) but overall it does not work well when
> > you
> > > > > have
> > > > > > to inject EMs or use Instance<>. Fixing this properly might
> > require a
> > > > > major
> > > > > > refactoring.
> > > > > >
> > > > > > On Tue, Dec 16, 2014 at 8:17 AM, Thomas Andraschko <
> > > > > > andraschko.thomas@gmail.com> wrote:
> > > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > i would make your repositories AppScoped.
> > > > > > > Unfortunately AppScoped doesn't work for abstract repositories
> > :/ I
> > > > > still
> > > > > > > have the same problem ->
> > > > > > > https://issues.apache.org/jira/browse/DELTASPIKE-647
> > > > > > >
> > > > > > >
> > > > > > > 2014-12-15 23:47 GMT+01:00 Thomas Frühbeck <fr...@aon.at>:
> > > > > > > >
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > we are integrating Data module of DS as vital part of our
> > > > persistence
> > > > > > > > layer, but unfortunately Repositories are not Serializable,
> so
> > > that
> > > > > > SFSB
> > > > > > > or
> > > > > > > > SessionScoped beans with Dependent scoped dependencies on
> > > > > Repositories
> > > > > > > will
> > > > > > > > fail in cluster configurations.
> > > > > > > >
> > > > > > > > Due to some recent overuse of scoped dependencies we would
> like
> > > to
> > > > > > > refrain
> > > > > > > > from again starting to scope vital infrastructure.
> > > > > > > >
> > > > > > > > Can you give some advice, which way to solve this problem?
> > > > > > > >
> > > > > > > > Many thanks for your dedication to DeltaSpike and your help,
> > > > > > > > Thomas
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: Data module and serializability in cluster w/ distributable session

Posted by Thomas Hug <th...@gmail.com>.
AFAIR it's not abstract repositories per se, it's the combination of an
abstract class extending an abstract class implementing an interface which
is somehow broken (took me ages to find that case and bounce the issue back
to PartialBeans). Which is what you get extending AbstractEntityRepository.

=> You can skip AbstractEntityRepository, implement EntityRepository
directly and get the EM injected. Umm, haven't tried that actually but
stating it boldly here ;-)

For the drawback, AppScope should definitely work fine (only some people
react allergic to proxies ;-).

On Tue, Dec 16, 2014 at 3:45 PM, Thomas Andraschko <
andraschko.thomas@gmail.com> wrote:
>
> Nothing, works perfectly fine.
> We have just a bug in our partial bean module if the repo is abstract.
> Interfaces are working fine.
> Nevertheless, most of my repositories are abstract...
>
> 2014-12-16 15:41 GMT+01:00 Karl Kildén <ka...@gmail.com>:
> >
> > Whats the drawback for @ApplicationScoped eg.
> >
> > @Repository
> > @ApplicationScoped
> > public interface UserRepository extends EntityRepository<User, Long> {
> >
> > User findOptionalByUsernameEqual(String username);
> > }
> >
> > On 16 December 2014 at 14:23, Thomas Andraschko <
> > andraschko.thomas@gmail.com
> > > wrote:
> > >
> > > :D
> > >
> > > IMO it also doesn't make sense to serialize repositories!
> > >
> > > 2014-12-16 14:16 GMT+01:00 Thomas Hug <th...@gmail.com>:
> > > >
> > > > Officially declaring this the "Thomas" thread ;-)
> > > >
> > > > Agree with Thomas that going for AppScope is probably the simplest
> > > > workaround for now. I remember some efforts for serialization (as OWB
> > > > complained for some cases) but overall it does not work well when you
> > > have
> > > > to inject EMs or use Instance<>. Fixing this properly might require a
> > > major
> > > > refactoring.
> > > >
> > > > On Tue, Dec 16, 2014 at 8:17 AM, Thomas Andraschko <
> > > > andraschko.thomas@gmail.com> wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > i would make your repositories AppScoped.
> > > > > Unfortunately AppScoped doesn't work for abstract repositories :/ I
> > > still
> > > > > have the same problem ->
> > > > > https://issues.apache.org/jira/browse/DELTASPIKE-647
> > > > >
> > > > >
> > > > > 2014-12-15 23:47 GMT+01:00 Thomas Frühbeck <fr...@aon.at>:
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > we are integrating Data module of DS as vital part of our
> > persistence
> > > > > > layer, but unfortunately Repositories are not Serializable, so
> that
> > > > SFSB
> > > > > or
> > > > > > SessionScoped beans with Dependent scoped dependencies on
> > > Repositories
> > > > > will
> > > > > > fail in cluster configurations.
> > > > > >
> > > > > > Due to some recent overuse of scoped dependencies we would like
> to
> > > > > refrain
> > > > > > from again starting to scope vital infrastructure.
> > > > > >
> > > > > > Can you give some advice, which way to solve this problem?
> > > > > >
> > > > > > Many thanks for your dedication to DeltaSpike and your help,
> > > > > > Thomas
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: Data module and serializability in cluster w/ distributable session

Posted by Karl Kildén <ka...@gmail.com>.
Whats the drawback for @ApplicationScoped eg.

@Repository
@ApplicationScoped
public interface UserRepository extends EntityRepository<User, Long> {

User findOptionalByUsernameEqual(String username);
}

On 16 December 2014 at 14:23, Thomas Andraschko <andraschko.thomas@gmail.com
> wrote:
>
> :D
>
> IMO it also doesn't make sense to serialize repositories!
>
> 2014-12-16 14:16 GMT+01:00 Thomas Hug <th...@gmail.com>:
> >
> > Officially declaring this the "Thomas" thread ;-)
> >
> > Agree with Thomas that going for AppScope is probably the simplest
> > workaround for now. I remember some efforts for serialization (as OWB
> > complained for some cases) but overall it does not work well when you
> have
> > to inject EMs or use Instance<>. Fixing this properly might require a
> major
> > refactoring.
> >
> > On Tue, Dec 16, 2014 at 8:17 AM, Thomas Andraschko <
> > andraschko.thomas@gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > i would make your repositories AppScoped.
> > > Unfortunately AppScoped doesn't work for abstract repositories :/ I
> still
> > > have the same problem ->
> > > https://issues.apache.org/jira/browse/DELTASPIKE-647
> > >
> > >
> > > 2014-12-15 23:47 GMT+01:00 Thomas Frühbeck <fr...@aon.at>:
> > > >
> > > > Hi,
> > > >
> > > > we are integrating Data module of DS as vital part of our persistence
> > > > layer, but unfortunately Repositories are not Serializable, so that
> > SFSB
> > > or
> > > > SessionScoped beans with Dependent scoped dependencies on
> Repositories
> > > will
> > > > fail in cluster configurations.
> > > >
> > > > Due to some recent overuse of scoped dependencies we would like to
> > > refrain
> > > > from again starting to scope vital infrastructure.
> > > >
> > > > Can you give some advice, which way to solve this problem?
> > > >
> > > > Many thanks for your dedication to DeltaSpike and your help,
> > > > Thomas
> > > >
> > >
> >
>

Re: Data module and serializability in cluster w/ distributable session

Posted by Thomas Andraschko <an...@gmail.com>.
:D

IMO it also doesn't make sense to serialize repositories!

2014-12-16 14:16 GMT+01:00 Thomas Hug <th...@gmail.com>:
>
> Officially declaring this the "Thomas" thread ;-)
>
> Agree with Thomas that going for AppScope is probably the simplest
> workaround for now. I remember some efforts for serialization (as OWB
> complained for some cases) but overall it does not work well when you have
> to inject EMs or use Instance<>. Fixing this properly might require a major
> refactoring.
>
> On Tue, Dec 16, 2014 at 8:17 AM, Thomas Andraschko <
> andraschko.thomas@gmail.com> wrote:
> >
> > Hi,
> >
> > i would make your repositories AppScoped.
> > Unfortunately AppScoped doesn't work for abstract repositories :/ I still
> > have the same problem ->
> > https://issues.apache.org/jira/browse/DELTASPIKE-647
> >
> >
> > 2014-12-15 23:47 GMT+01:00 Thomas Frühbeck <fr...@aon.at>:
> > >
> > > Hi,
> > >
> > > we are integrating Data module of DS as vital part of our persistence
> > > layer, but unfortunately Repositories are not Serializable, so that
> SFSB
> > or
> > > SessionScoped beans with Dependent scoped dependencies on Repositories
> > will
> > > fail in cluster configurations.
> > >
> > > Due to some recent overuse of scoped dependencies we would like to
> > refrain
> > > from again starting to scope vital infrastructure.
> > >
> > > Can you give some advice, which way to solve this problem?
> > >
> > > Many thanks for your dedication to DeltaSpike and your help,
> > > Thomas
> > >
> >
>

Re: Data module and serializability in cluster w/ distributable session

Posted by Thomas Hug <th...@gmail.com>.
Officially declaring this the "Thomas" thread ;-)

Agree with Thomas that going for AppScope is probably the simplest
workaround for now. I remember some efforts for serialization (as OWB
complained for some cases) but overall it does not work well when you have
to inject EMs or use Instance<>. Fixing this properly might require a major
refactoring.

On Tue, Dec 16, 2014 at 8:17 AM, Thomas Andraschko <
andraschko.thomas@gmail.com> wrote:
>
> Hi,
>
> i would make your repositories AppScoped.
> Unfortunately AppScoped doesn't work for abstract repositories :/ I still
> have the same problem ->
> https://issues.apache.org/jira/browse/DELTASPIKE-647
>
>
> 2014-12-15 23:47 GMT+01:00 Thomas Frühbeck <fr...@aon.at>:
> >
> > Hi,
> >
> > we are integrating Data module of DS as vital part of our persistence
> > layer, but unfortunately Repositories are not Serializable, so that SFSB
> or
> > SessionScoped beans with Dependent scoped dependencies on Repositories
> will
> > fail in cluster configurations.
> >
> > Due to some recent overuse of scoped dependencies we would like to
> refrain
> > from again starting to scope vital infrastructure.
> >
> > Can you give some advice, which way to solve this problem?
> >
> > Many thanks for your dedication to DeltaSpike and your help,
> > Thomas
> >
>