-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: How to include JBOSS_HOME property in persistence.xml ?
PostPosted: Mon Jul 02, 2012 8:38 pm 
Regular
Regular

Joined: Tue May 17, 2011 1:45 am
Posts: 52
Hi,

I want to create the Index, relative to my JBOSS_HOME. How can I use this in persistence.xml

Example
<property name="hibernate.search.default.sourceBase" value="${JBOSS_HOME}/index/default"/>


Top
 Profile  
 
 Post subject: Re: How to include JBOSS_HOME property in persistence.xml ?
PostPosted: Wed Jul 04, 2012 4:56 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

have you actually tried the example below. Depending on the version of JBoss AS you are using it should actually work. Are you using AS 7? I think in the earlier versions it did not work, but it should work now. See also https://issues.jboss.org/browse/AS7-3195

Another alternative might be to use build time filtering to write the right value into persistence.xml at build time.

Let us know if you get it to work and if not you can maybe provide some more information about your environment.

--Hardy


Top
 Profile  
 
 Post subject: Re: How to include JBOSS_HOME property in persistence.xml ?
PostPosted: Wed Jul 04, 2012 11:53 pm 
Regular
Regular

Joined: Tue May 17, 2011 1:45 am
Posts: 52
Thanks Hardy,

Sorry I could not figure out which example you are referring to. Did you mean the one in JIRA?

I do use JBoss AS 7.1.1

Regards
David


Top
 Profile  
 
 Post subject: Re: How to include JBOSS_HOME property in persistence.xml ?
PostPosted: Thu Jul 05, 2012 4:33 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I should have said, above. I meant your example. Looking at the Jira issue variable substitution was fixed for AS 7.1.1, so it should work. I am not 100% sure whether environment variables work as well or whether the properties have to be passed via -Dfoo=bar or specified in standalone.xml. How do you specify/set the variable? If it is an environment variable and it does not work, could you try to specify it on the Java command line?

--Hardy


Top
 Profile  
 
 Post subject: Re: How to include JBOSS_HOME property in persistence.xml ?
PostPosted: Thu Jul 05, 2012 8:26 am 
Red Hat Associate
Red Hat Associate

Joined: Wed Apr 18, 2012 9:06 pm
Posts: 6
Make sure that as7/standalone/configuration/standalone.xml has :
<spec-descriptor-property-replacement>true</spec-descriptor-property-replacement>

This was reported as a bug recently (https://issues.jboss.org/browse/AS7-5015) that is resolved by setting the spec-descriptor-property-replacement to true. As mentioned in the jira, I was able to pass a property definition when starting AS which was used in the persistence.xml.

./standalone.sh "-Dtest.ds=java:jboss/datasources/ExampleDS"

Hope this helps.

Scott


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.