[ https://issues.jboss.org/browse/WFLY-5478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115664#comment-13115664 ]
Scott Marlow edited comment on WFLY-5478 at 10/6/15 3:38 PM:
-------------------------------------------------------------
Also works with:
{quote}
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="primary">
<!-- If you are running in a production environment, add a managed
data source, this example data source is just for devleopment and testing! -->
<!-- The datasource is deployed as WEB-INF/hibernate4-quickstart-ds.xml, you
can find it in the source at src/main/webapp/WEB-INF/hibernate4-quickstart-ds.xml -->
<jta-data-source>java:jboss/datasources/Hibernate4QuickstartDS</jta-data-source>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="false" />
<property name="jboss.as.jpa.scopedname" value="database_my"/>
</properties>
</persistence-unit>
</persistence>
{quote}
output of pwd:
{quote}
pwd
/deployment=wildfly-hibernate4.war/subsystem=jpa/hibernate-persistence-unit=scopedexamplename
{quote}
output of ls:
{quote}
ls
collection
entity
entity-cache
query-cache
close-statement-count=0
collection-fetch-count=0
collection-load-count=0
collection-recreated-count=0
collection-remove-count=0
collection-update-count=0
completed-transaction-count=0
connect-count=11
enabled=true
entity-delete-count=0
entity-fetch-count=0
entity-insert-count=0
entity-load-count=22
entity-update-count=0
flush-count=0
hibernate-persistence-unit=scopedexamplename
optimistic-failure-count=0
prepared-statement-count=11
query-cache-hit-count=0
query-cache-miss-count=0
query-cache-put-count=0
query-execution-count=11
query-execution-max-time=2
query-execution-max-time-query-string=[CRITERIA] select this_.id as id1_0_0_, this_.address as address2_0_0_, this_.email as email3_0_0_, this_.name as name4_0_0_, this_.phone_number as phone_nu5_0_0_ from MemberHibernate4Demo this_ order by this_.name asc
scoped-unit-name=scopedexamplename
second-level-cache-hit-count=0
second-level-cache-miss-count=0
second-level-cache-put-count=0
session-close-count=11
session-open-count=11
statistics-enabled=true
successful-transaction-count=0
{quote}
was (Author: smarlow):
Also works with:
{quote{
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="primary">
<!-- If you are running in a production environment, add a managed
data source, this example data source is just for devleopment and testing! -->
<!-- The datasource is deployed as WEB-INF/hibernate4-quickstart-ds.xml, you
can find it in the source at src/main/webapp/WEB-INF/hibernate4-quickstart-ds.xml -->
<jta-data-source>java:jboss/datasources/Hibernate4QuickstartDS</jta-data-source>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="false" />
<property name="jboss.as.jpa.scopedname" value="database_my"/>
</properties>
</persistence-unit>
</persistence>
{quote}
output of pwd:
{quote}
pwd
/deployment=wildfly-hibernate4.war/subsystem=jpa/hibernate-persistence-unit=scopedexamplename
{quote}
output of ls:
{quote}
ls
collection
entity
entity-cache
query-cache
close-statement-count=0
collection-fetch-count=0
collection-load-count=0
collection-recreated-count=0
collection-remove-count=0
collection-update-count=0
completed-transaction-count=0
connect-count=11
enabled=true
entity-delete-count=0
entity-fetch-count=0
entity-insert-count=0
entity-load-count=22
entity-update-count=0
flush-count=0
hibernate-persistence-unit=scopedexamplename
optimistic-failure-count=0
prepared-statement-count=11
query-cache-hit-count=0
query-cache-miss-count=0
query-cache-put-count=0
query-execution-count=11
query-execution-max-time=2
query-execution-max-time-query-string=[CRITERIA] select this_.id as id1_0_0_, this_.address as address2_0_0_, this_.email as email3_0_0_, this_.name as name4_0_0_, this_.phone_number as phone_nu5_0_0_ from MemberHibernate4Demo this_ order by this_.name asc
scoped-unit-name=scopedexamplename
second-level-cache-hit-count=0
second-level-cache-miss-count=0
second-level-cache-put-count=0
session-close-count=11
session-open-count=11
statistics-enabled=true
successful-transaction-count=0
{quote}
> allow custom scoped persistence unit name hint in persistence unit definition
> -----------------------------------------------------------------------------
>
> Key: WFLY-5478
> URL: https://issues.jboss.org/browse/WFLY-5478
> Project: WildFly
> Issue Type: Feature Request
> Components: JPA / Hibernate
> Affects Versions: JBoss AS7 7.1.1.Final, 8.0.0.Final, 9.0.0.Final, 10.0.0.CR2
> Reporter: Scott Marlow
> Assignee: Scott Marlow
>
> Consider allowing applications to override the scoped persistence unit name, so instead of using names like "test2.ear/w2.war#warPUnit_PU", the application can specify a unique (across all deployments on the app server) name.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)