You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Walter White <wa...@walterjwhite.com> on 2013/12/27 21:28:13 UTC

data module

Hi,

I am having issues when using the deltaspike data module to persist
entities:
http://stackoverflow.com/questions/20722811/apache-delta-spike-queryinvocationcontext


I am using glassfish with JTA, with parent-child relationships, it appears
it will attempt to insert 2 entities which results in a constraint error.
I confirmed the duplicate inserts via wireshark and can confirm 2 insert
statements are sent.

I'm hoping for some direction, perhaps it is a configuration issue.


Walter

Re: data module

Posted by Walter White <wa...@walterjwhite.com>.
Hi,

With more testing, I believe it is a multitude of things:

1. incorrect implementation of .equals and .hashCode may cause entity
manager to not save changes or duplicate changes (duplicate inserts)
2. incorrect entity manager configuration such as loading an entity from
em1 and saving with em2 causes state to be lost.  The example does not show
an Application-scoped EntityManager, but after I made the producer produce
an ApplicationScoped em, it worked fine.


There may be more caveats, but those are what I learned.  I'll plan on
updating via github later this weekend.

Thanks,

Walter



On Sat, Dec 28, 2013 at 8:21 AM, Walter White
<wa...@walterjwhite.com>wrote:

> I can writeup something when I'm completely finished, but I'm still having
> issues with my real entities ...
>
>
>
> Walter
>
>
> On Sat, Dec 28, 2013 at 3:55 AM, Karl Kildén <ka...@gmail.com>wrote:
>
>> Hello Jason!
>>
>> Afaik this looks decent: http://deltaspike.apache.org/data.html
>>
>>
>>
>>
>> On 28 December 2013 07:05, Jason Porter <li...@gmail.com> wrote:
>>
>> > Glad you were able to sort it out. An addition to the docs would be
>> great!
>> > I believe the docs for the data module are currently the README in the
>> git
>> > repo. Care to create a patch, or simply add them here via email? At the
>> > very least, please create a ticket so we don't forget to document this.
>> >
>> >
>> > Real usage like this helps us make DeltaSpike better and easier to use.
>> > Thank you very much for helping us out!
>> > —
>> > Sent from Mailbox for iPhone
>> >
>> > On Fri, Dec 27, 2013 at 10:32 PM, Walter White
>> > <wa...@walterjwhite.com> wrote:
>> >
>> > > It looks like glassfish and arquillian are correct, it appears to be
>> an
>> > > issue with .equals and .hashCode.  I found this out by starting from
>> > > scratch without a custom implementation for .equals and .hashCode
>> which
>> > is
>> > > what eclipselink uses to determine if the entity is the same or not.
>> >  This
>> > > might be a good item for the FAQ or at least my FAQ.
>> > > Thanks,
>> > > Walter
>> > > On Fri, Dec 27, 2013 at 4:43 PM, Walter White
>> > > <wa...@walterjwhite.com>wrote:
>> > >> Ok, I'll try that after I check my configuration.  I will
>> update/check
>> > >> persistence.xml to ensure it is properly configured, then test with
>> > >> arquillian.
>> > >>
>> > >>
>> > >> On Fri, Dec 27, 2013 at 4:40 PM, Jason Porter <
>> lightguard.jp@gmail.com
>> > >wrote:
>> > >>
>> > >>> Can you recreate with an Arquillian test to see if it's just
>> > glassfish?—
>> > >>> Sent from Mailbox for iPhone
>> > >>>
>> > >>> On Fri, Dec 27, 2013 at 1:35 PM, Walter White
>> > >>> <wa...@walterjwhite.com> wrote:
>> > >>>
>> > >>> > Hi,
>> > >>> > I am having issues when using the deltaspike data module to
>> persist
>> > >>> > entities:
>> > >>> >
>> > >>>
>> >
>> http://stackoverflow.com/questions/20722811/apache-delta-spike-queryinvocationcontext
>> > >>> > I am using glassfish with JTA, with parent-child relationships, it
>> > >>> appears
>> > >>> > it will attempt to insert 2 entities which results in a constraint
>> > >>> error.
>> > >>> > I confirmed the duplicate inserts via wireshark and can confirm 2
>> > insert
>> > >>> > statements are sent.
>> > >>> > I'm hoping for some direction, perhaps it is a configuration
>> issue.
>> > >>> > Walter
>> > >>>
>> > >>
>> > >>
>> >
>>
>
>

Re: data module

Posted by Walter White <wa...@walterjwhite.com>.
I can writeup something when I'm completely finished, but I'm still having
issues with my real entities ...



Walter


On Sat, Dec 28, 2013 at 3:55 AM, Karl Kildén <ka...@gmail.com> wrote:

> Hello Jason!
>
> Afaik this looks decent: http://deltaspike.apache.org/data.html
>
>
>
>
> On 28 December 2013 07:05, Jason Porter <li...@gmail.com> wrote:
>
> > Glad you were able to sort it out. An addition to the docs would be
> great!
> > I believe the docs for the data module are currently the README in the
> git
> > repo. Care to create a patch, or simply add them here via email? At the
> > very least, please create a ticket so we don't forget to document this.
> >
> >
> > Real usage like this helps us make DeltaSpike better and easier to use.
> > Thank you very much for helping us out!
> > —
> > Sent from Mailbox for iPhone
> >
> > On Fri, Dec 27, 2013 at 10:32 PM, Walter White
> > <wa...@walterjwhite.com> wrote:
> >
> > > It looks like glassfish and arquillian are correct, it appears to be an
> > > issue with .equals and .hashCode.  I found this out by starting from
> > > scratch without a custom implementation for .equals and .hashCode which
> > is
> > > what eclipselink uses to determine if the entity is the same or not.
> >  This
> > > might be a good item for the FAQ or at least my FAQ.
> > > Thanks,
> > > Walter
> > > On Fri, Dec 27, 2013 at 4:43 PM, Walter White
> > > <wa...@walterjwhite.com>wrote:
> > >> Ok, I'll try that after I check my configuration.  I will update/check
> > >> persistence.xml to ensure it is properly configured, then test with
> > >> arquillian.
> > >>
> > >>
> > >> On Fri, Dec 27, 2013 at 4:40 PM, Jason Porter <
> lightguard.jp@gmail.com
> > >wrote:
> > >>
> > >>> Can you recreate with an Arquillian test to see if it's just
> > glassfish?—
> > >>> Sent from Mailbox for iPhone
> > >>>
> > >>> On Fri, Dec 27, 2013 at 1:35 PM, Walter White
> > >>> <wa...@walterjwhite.com> wrote:
> > >>>
> > >>> > Hi,
> > >>> > I am having issues when using the deltaspike data module to persist
> > >>> > entities:
> > >>> >
> > >>>
> >
> http://stackoverflow.com/questions/20722811/apache-delta-spike-queryinvocationcontext
> > >>> > I am using glassfish with JTA, with parent-child relationships, it
> > >>> appears
> > >>> > it will attempt to insert 2 entities which results in a constraint
> > >>> error.
> > >>> > I confirmed the duplicate inserts via wireshark and can confirm 2
> > insert
> > >>> > statements are sent.
> > >>> > I'm hoping for some direction, perhaps it is a configuration issue.
> > >>> > Walter
> > >>>
> > >>
> > >>
> >
>

Re: data module

Posted by Karl Kildén <ka...@gmail.com>.
Hello Jason!

Afaik this looks decent: http://deltaspike.apache.org/data.html




On 28 December 2013 07:05, Jason Porter <li...@gmail.com> wrote:

> Glad you were able to sort it out. An addition to the docs would be great!
> I believe the docs for the data module are currently the README in the git
> repo. Care to create a patch, or simply add them here via email? At the
> very least, please create a ticket so we don't forget to document this.
>
>
> Real usage like this helps us make DeltaSpike better and easier to use.
> Thank you very much for helping us out!
> —
> Sent from Mailbox for iPhone
>
> On Fri, Dec 27, 2013 at 10:32 PM, Walter White
> <wa...@walterjwhite.com> wrote:
>
> > It looks like glassfish and arquillian are correct, it appears to be an
> > issue with .equals and .hashCode.  I found this out by starting from
> > scratch without a custom implementation for .equals and .hashCode which
> is
> > what eclipselink uses to determine if the entity is the same or not.
>  This
> > might be a good item for the FAQ or at least my FAQ.
> > Thanks,
> > Walter
> > On Fri, Dec 27, 2013 at 4:43 PM, Walter White
> > <wa...@walterjwhite.com>wrote:
> >> Ok, I'll try that after I check my configuration.  I will update/check
> >> persistence.xml to ensure it is properly configured, then test with
> >> arquillian.
> >>
> >>
> >> On Fri, Dec 27, 2013 at 4:40 PM, Jason Porter <lightguard.jp@gmail.com
> >wrote:
> >>
> >>> Can you recreate with an Arquillian test to see if it's just
> glassfish?—
> >>> Sent from Mailbox for iPhone
> >>>
> >>> On Fri, Dec 27, 2013 at 1:35 PM, Walter White
> >>> <wa...@walterjwhite.com> wrote:
> >>>
> >>> > Hi,
> >>> > I am having issues when using the deltaspike data module to persist
> >>> > entities:
> >>> >
> >>>
> http://stackoverflow.com/questions/20722811/apache-delta-spike-queryinvocationcontext
> >>> > I am using glassfish with JTA, with parent-child relationships, it
> >>> appears
> >>> > it will attempt to insert 2 entities which results in a constraint
> >>> error.
> >>> > I confirmed the duplicate inserts via wireshark and can confirm 2
> insert
> >>> > statements are sent.
> >>> > I'm hoping for some direction, perhaps it is a configuration issue.
> >>> > Walter
> >>>
> >>
> >>
>

Re: data module

Posted by Jason Porter <li...@gmail.com>.
Glad you were able to sort it out. An addition to the docs would be great! I believe the docs for the data module are currently the README in the git repo. Care to create a patch, or simply add them here via email? At the very least, please create a ticket so we don't forget to document this. 


Real usage like this helps us make DeltaSpike better and easier to use. Thank you very much for helping us out!
—
Sent from Mailbox for iPhone

On Fri, Dec 27, 2013 at 10:32 PM, Walter White
<wa...@walterjwhite.com> wrote:

> It looks like glassfish and arquillian are correct, it appears to be an
> issue with .equals and .hashCode.  I found this out by starting from
> scratch without a custom implementation for .equals and .hashCode which is
> what eclipselink uses to determine if the entity is the same or not.  This
> might be a good item for the FAQ or at least my FAQ.
> Thanks,
> Walter
> On Fri, Dec 27, 2013 at 4:43 PM, Walter White
> <wa...@walterjwhite.com>wrote:
>> Ok, I'll try that after I check my configuration.  I will update/check
>> persistence.xml to ensure it is properly configured, then test with
>> arquillian.
>>
>>
>> On Fri, Dec 27, 2013 at 4:40 PM, Jason Porter <li...@gmail.com>wrote:
>>
>>> Can you recreate with an Arquillian test to see if it's just glassfish?—
>>> Sent from Mailbox for iPhone
>>>
>>> On Fri, Dec 27, 2013 at 1:35 PM, Walter White
>>> <wa...@walterjwhite.com> wrote:
>>>
>>> > Hi,
>>> > I am having issues when using the deltaspike data module to persist
>>> > entities:
>>> >
>>> http://stackoverflow.com/questions/20722811/apache-delta-spike-queryinvocationcontext
>>> > I am using glassfish with JTA, with parent-child relationships, it
>>> appears
>>> > it will attempt to insert 2 entities which results in a constraint
>>> error.
>>> > I confirmed the duplicate inserts via wireshark and can confirm 2 insert
>>> > statements are sent.
>>> > I'm hoping for some direction, perhaps it is a configuration issue.
>>> > Walter
>>>
>>
>>

Re: data module

Posted by Walter White <wa...@walterjwhite.com>.
It looks like glassfish and arquillian are correct, it appears to be an
issue with .equals and .hashCode.  I found this out by starting from
scratch without a custom implementation for .equals and .hashCode which is
what eclipselink uses to determine if the entity is the same or not.  This
might be a good item for the FAQ or at least my FAQ.


Thanks,

Walter


On Fri, Dec 27, 2013 at 4:43 PM, Walter White
<wa...@walterjwhite.com>wrote:

> Ok, I'll try that after I check my configuration.  I will update/check
> persistence.xml to ensure it is properly configured, then test with
> arquillian.
>
>
> On Fri, Dec 27, 2013 at 4:40 PM, Jason Porter <li...@gmail.com>wrote:
>
>> Can you recreate with an Arquillian test to see if it's just glassfish?—
>> Sent from Mailbox for iPhone
>>
>> On Fri, Dec 27, 2013 at 1:35 PM, Walter White
>> <wa...@walterjwhite.com> wrote:
>>
>> > Hi,
>> > I am having issues when using the deltaspike data module to persist
>> > entities:
>> >
>> http://stackoverflow.com/questions/20722811/apache-delta-spike-queryinvocationcontext
>> > I am using glassfish with JTA, with parent-child relationships, it
>> appears
>> > it will attempt to insert 2 entities which results in a constraint
>> error.
>> > I confirmed the duplicate inserts via wireshark and can confirm 2 insert
>> > statements are sent.
>> > I'm hoping for some direction, perhaps it is a configuration issue.
>> > Walter
>>
>
>

Re: data module

Posted by Walter White <wa...@walterjwhite.com>.
Ok, I'll try that after I check my configuration.  I will update/check
persistence.xml to ensure it is properly configured, then test with
arquillian.


On Fri, Dec 27, 2013 at 4:40 PM, Jason Porter <li...@gmail.com>wrote:

> Can you recreate with an Arquillian test to see if it's just glassfish?—
> Sent from Mailbox for iPhone
>
> On Fri, Dec 27, 2013 at 1:35 PM, Walter White
> <wa...@walterjwhite.com> wrote:
>
> > Hi,
> > I am having issues when using the deltaspike data module to persist
> > entities:
> >
> http://stackoverflow.com/questions/20722811/apache-delta-spike-queryinvocationcontext
> > I am using glassfish with JTA, with parent-child relationships, it
> appears
> > it will attempt to insert 2 entities which results in a constraint error.
> > I confirmed the duplicate inserts via wireshark and can confirm 2 insert
> > statements are sent.
> > I'm hoping for some direction, perhaps it is a configuration issue.
> > Walter
>

Re: data module

Posted by Jason Porter <li...@gmail.com>.
Can you recreate with an Arquillian test to see if it's just glassfish?—
Sent from Mailbox for iPhone

On Fri, Dec 27, 2013 at 1:35 PM, Walter White
<wa...@walterjwhite.com> wrote:

> Hi,
> I am having issues when using the deltaspike data module to persist
> entities:
> http://stackoverflow.com/questions/20722811/apache-delta-spike-queryinvocationcontext
> I am using glassfish with JTA, with parent-child relationships, it appears
> it will attempt to insert 2 entities which results in a constraint error.
> I confirmed the duplicate inserts via wireshark and can confirm 2 insert
> statements are sent.
> I'm hoping for some direction, perhaps it is a configuration issue.
> Walter