[jira] [Commented] (DELTASPIKE-965) EntityRepository.save() is broken for entities with String ID

2015-07-27 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14643078#comment-14643078
 ] 

Gerhard Petracek commented on DELTASPIKE-965:
-

@harald:
as a ds-committer you don't need to use pull-requests.
commit it directly or if you aren't sure about it, push it to your own fork - 
just provide the link (and you can skip the pull-request itself).

 EntityRepository.save() is broken for entities with String ID
 -

 Key: DELTASPIKE-965
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-965
 Project: DeltaSpike
  Issue Type: Bug
  Components: Data-Module
Affects Versions: 1.4.2
Reporter: Harald Wellmann
Assignee: Daniel Cunha (soro)
Priority: Blocker
 Fix For: 1.4.3


 EntityRepository.save() generates illegal SQL when the entity identity is of 
 String type.
 This is a regression introduced in 1.4.2 with 
 {{org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext.countCheck(Object)}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DELTASPIKE-965) EntityRepository.save() is broken for entities with String ID

2015-07-27 Thread Daniel Cunha (soro) (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14643025#comment-14643025
 ] 

Daniel Cunha (soro) commented on DELTASPIKE-965:


It's weird, this method was created because before we had a problem with String 
ID.
If you can to see the deltaspike-dev list, Akm had this problem and we resolve 
in 1.4.2.

I saw your comments in GitHub and we can improve the method, really.
But, I tested it and work fine.

I put this new test:
https://github.com/danielsoro/deltaspike/commit/24d6f86cd3a19a656281e162979560e1a917f6ff

Please, add a test that fail in your repository, will be more easy to fix it.
Thank you [~hwellmann]

 EntityRepository.save() is broken for entities with String ID
 -

 Key: DELTASPIKE-965
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-965
 Project: DeltaSpike
  Issue Type: Bug
  Components: Data-Module
Affects Versions: 1.4.2
Reporter: Harald Wellmann
Priority: Blocker
 Fix For: 1.4.3


 EntityRepository.save() generates illegal SQL when the entity identity is of 
 String type.
 This is a regression introduced in 1.4.2 with 
 {{org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext.countCheck(Object)}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DELTASPIKE-965) EntityRepository.save() is broken for entities with String ID

2015-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14643038#comment-14643038
 ] 

ASF GitHub Bot commented on DELTASPIKE-965:
---

GitHub user hwellmann opened a pull request:

https://github.com/apache/deltaspike/pull/40

DELTASPIKE-965 use query parameter to interpolate ID value



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/hwellmann/deltaspike DELTASPIKE-965

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/deltaspike/pull/40.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #40


commit e56035aa82babce38ec092a73e45a33488f681e5
Author: Harald Wellmann harald.wellm...@gmx.de
Date:   2015-07-27T16:04:07Z

DELTASPIKE-965 failing test demonstrating the problem

commit b11d8174bf4a090db6b78666f06aeab04555b37b
Author: Harald Wellmann harald.wellm...@gmx.de
Date:   2015-07-27T16:07:31Z

DELTASPIKE-965 Use query parameter to properly interpolate ID values




 EntityRepository.save() is broken for entities with String ID
 -

 Key: DELTASPIKE-965
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-965
 Project: DeltaSpike
  Issue Type: Bug
  Components: Data-Module
Affects Versions: 1.4.2
Reporter: Harald Wellmann
Assignee: Daniel Cunha (soro)
Priority: Blocker
 Fix For: 1.4.3


 EntityRepository.save() generates illegal SQL when the entity identity is of 
 String type.
 This is a regression introduced in 1.4.2 with 
 {{org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext.countCheck(Object)}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DELTASPIKE-965) EntityRepository.save() is broken for entities with String ID

2015-07-27 Thread Harald Wellmann (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14643223#comment-14643223
 ] 

Harald Wellmann commented on DELTASPIKE-965:


Ok, I pushed my fix. Not quite sure yet if this is the best solution, but at 
least it fixes a showstopper, and we can further improve on it.

As far as I can see, this issue is a showstopper for anyone using the Data 
module with entities containing a String ID which is not generated, so I'm a 
bit surprised nobody else ran into the problem yet...

I bumped into it when trying to upgrade my daytime project to from 1.3.0 to 
1.4.2 this morning (just another manic Monday...). As a workaround, I 
downgraded to 1.4.1, but I'd really like to see a 1.4.3 release with a fix 
rather soon.

 EntityRepository.save() is broken for entities with String ID
 -

 Key: DELTASPIKE-965
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-965
 Project: DeltaSpike
  Issue Type: Bug
  Components: Data-Module
Affects Versions: 1.4.2
Reporter: Harald Wellmann
Assignee: Daniel Cunha (soro)
Priority: Blocker
 Fix For: 1.4.3


 EntityRepository.save() generates illegal SQL when the entity identity is of 
 String type.
 This is a regression introduced in 1.4.2 with 
 {{org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext.countCheck(Object)}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DELTASPIKE-965) EntityRepository.save() is broken for entities with String ID

2015-07-27 Thread Daniel Cunha (soro) (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14643255#comment-14643255
 ] 

Daniel Cunha (soro) commented on DELTASPIKE-965:


If all test pass.. I think that we need to provide better tests to coverage 
your problem.
Try create a sample e share it.. will be more easy to fix it.

Thank you [~hwellmann]

 EntityRepository.save() is broken for entities with String ID
 -

 Key: DELTASPIKE-965
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-965
 Project: DeltaSpike
  Issue Type: Bug
  Components: Data-Module
Affects Versions: 1.4.2
Reporter: Harald Wellmann
Assignee: Harald Wellmann
Priority: Blocker
 Fix For: 1.4.3


 EntityRepository.save() generates illegal SQL when the entity identity is of 
 String type.
 This is a regression introduced in 1.4.2 with 
 {{org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext.countCheck(Object)}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DELTASPIKE-965) EntityRepository.save() is broken for entities with String ID

2015-07-27 Thread Daniel Cunha (soro) (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14643178#comment-14643178
 ] 

Daniel Cunha (soro) commented on DELTASPIKE-965:


Yes, really necessary.

Before we used PersistecenUnitUtil#getIdentify

We had this problem:
http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/file/n4661005/CascadeRefreshGradleTestProject.zip

You have 2 entity where ID isn't auto generated
the problem is: he set ID of the parent and ID of the children. you call the 
save of the entityRepository, entityRepository.save call merge, because for it, 
it isn't a new Entity.

We used PersistenceUnitUtil for check it, but see the javadoc for it: 
http://docs.oracle.com/javaee/6/api/javax/persistence/PersistenceUnitUtil.html#getIdentifier%28java.lang.Object%29

In discussion with Gerhard we found a solution for it:
i guess the only portable check is EntityManager#contains and if it returns 
false a #load with the id if the id is available, the part with #contains 
just to be faster with entities which are really loaded by the em, well - 
instead of #load a count query would be better to avoid that it really loads 
the entity.

then we changed it.

For me works fine, I didn't have any problem with it. ATM.

But, your change is cool, more expressive, please.. push direct in repository 
or I can do it, if you prefer. :)

 EntityRepository.save() is broken for entities with String ID
 -

 Key: DELTASPIKE-965
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-965
 Project: DeltaSpike
  Issue Type: Bug
  Components: Data-Module
Affects Versions: 1.4.2
Reporter: Harald Wellmann
Assignee: Daniel Cunha (soro)
Priority: Blocker
 Fix For: 1.4.3


 EntityRepository.save() generates illegal SQL when the entity identity is of 
 String type.
 This is a regression introduced in 1.4.2 with 
 {{org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext.countCheck(Object)}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DELTASPIKE-965) EntityRepository.save() is broken for entities with String ID

2015-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14643242#comment-14643242
 ] 

ASF GitHub Bot commented on DELTASPIKE-965:
---

Github user asfgit closed the pull request at:

https://github.com/apache/deltaspike/pull/40


 EntityRepository.save() is broken for entities with String ID
 -

 Key: DELTASPIKE-965
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-965
 Project: DeltaSpike
  Issue Type: Bug
  Components: Data-Module
Affects Versions: 1.4.2
Reporter: Harald Wellmann
Assignee: Daniel Cunha (soro)
Priority: Blocker
 Fix For: 1.4.3


 EntityRepository.save() generates illegal SQL when the entity identity is of 
 String type.
 This is a regression introduced in 1.4.2 with 
 {{org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext.countCheck(Object)}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)