[
https://issues.jboss.org/browse/WFLY-2727?page=com.atlassian.jira.plugin....
]
arjan tijms commented on WFLY-2727:
-----------------------------------
{quote}Note that we implemented an extension in Hibernate to allow the persistence unit to
be created in two phases. When/if the extension is standardized as part of some future JPA
spec release, hopefully we will have all persistence providers (in their new releases)
implementing it.{quote}
Maybe I don't fully understand, but since Hibernate is used by WildFly and part of the
JBoss community, what is stopping things from working out of the box now? Or is the
extension you mention for a version of Hibernate newer than what WildFly is currently
using?
{quote}to reflect that you cannot use both CDI-JPA features and @DataSourceDefinition from
the same application.{quote}
Okay, so that's indeed more clear. But practically speaking there's also the issue
now that users have to add the above mentioned property, isn't there? Since
{{@DataSourceDefinition}} is largely an ease-of-use feature, this may be a bit problematic
for exactly those users who are the intended target. If the issue can't be solved
otherwise for the short term, would it be an option to provide a hint to the user when
logging the error that this property needs to be set?
{quote}Regarding the comment on JAVAEE_SPEC-30 about vendors not wanting to support
@DataSourceDefinition.{quote}
Well the comment wasn't so much about vendors not wanting to support it (for whatever
reason), but more that I got the impression that some of them were genuinely surprised
that such data source also had to work with JPA. The spec only talks about injecting it
via {{@Resource}}, so there may be some room for clarification there.
There is at least 1 vendor if I'm not mistaken who seems to be against any kind of
administered object inside an archive (including JMS destinations, email sessions, JASPIC
security modules, data sources and what have you), but that's an entirely different
story ;)
{quote} If we add a standardized two-phase persistence unit bootstrap that doesn't use
the Datasource or CDI beanmanager until the second PU boot phase, we will see fewer
integration problems between the different technologies (CDI/@DataSourceDefinitiion) and
JPA. {quote}
This sounds like a very important improvement indeed and certainly worth it to create a
JIRA issue on the JPA tracker for.
@DataSourceDefinition defined data source can't be used in
persistence.xml with CDI entity listeners
----------------------------------------------------------------------------------------------------
Key: WFLY-2727
URL:
https://issues.jboss.org/browse/WFLY-2727
Project: WildFly
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: EE, JPA / Hibernate
Affects Versions: 8.0.0.CR1
Reporter: arjan tijms
Assignee: Scott Marlow
Defining a data source from within the application using either {{@DataSourceDefinition}}
on a class or the {{data-source}} element in {{web.xml}}, and then using this in
{{persistence.xml}} will cause a deployment failure.
E.g.
{code:xml|title=web.xml}
<data-source>
<name>java:app/MyApp/MyDS</name>
<class-name>org.h2.jdbcx.JdbcDataSource</class-name>
<url>jdbc:h2:mem:test</url>
</data-source>
{code}
and
{code:xml|title=persistence.xml}
<persistence-unit name="testPU">
<jta-data-source>java:app/MyApp/MyDS</jta-data-source>
</persistence-unit>
{code}
will result in:
{noformat}
ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 3)
JBAS014613: Operation ("deploy") failed - address: ([("deployment"
=> "dca783dd-b383-4a16-85a4-1331a2f89354.war")]) - failure description:
{"JBAS014771: Services with missing/unavailable dependencies" =>
["jboss.persistenceunit.\"dca783dd-b383-4a16-85a4-1331a2f89354.war#testPU\".__FIRST_PHASE__
is missing
[jboss.naming.context.java.app.dca783dd-b383-4a16-85a4-1331a2f89354.MyApp.MyDS]"]}
ERROR [org.jboss.as.server] (management-handler-thread - 3) JBAS015870: Deploy of
deployment "dca783dd-b383-4a16-85a4-1331a2f89354.war" was rolled back with the
following failure message: {"JBAS014771: Services with missing/unavailable
dependencies" =>
["jboss.persistenceunit.\"dca783dd-b383-4a16-85a4-1331a2f89354.war#testPU\".__FIRST_PHASE__
is missing
[jboss.naming.context.java.app.dca783dd-b383-4a16-85a4-1331a2f89354.MyApp.MyDS]"]}
{noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira