-->
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.  [ 4 posts ] 
Author Message
 Post subject: datasource properties on server
PostPosted: Mon Sep 01, 2014 2:44 am 
Newbie

Joined: Mon Sep 01, 2014 2:23 am
Posts: 5
Is it possible to customize hibernate ogm datastore in such a way to use datasource properties from application server (the same way it's usually done with mysql connectors)?
I have a scenario where deployed war application should inherit settings from existing environment - rather than use these embedded in persistence.xml: hibernate.ogm.datastore.host and hibernate.ogm.datastore.port.

I did some experiments on WildFly - added some properties to datasource (java:jboss/datasources/ExampleDS) but Hibernate OGM is ignoring them. According to documentation it's expected behavior...
"In your persistence.xml, you also need to define an existing datasource. It is not needed by Hibernate OGM and won’t be used but the JPA specification mandates this setting."

Could you please give me some hints where/what should I look for in order to implement such functionality - if it's not available out of box already?

I am using WildFly 8.1 and Hibernate OGM 4.1.0.Beta1 with custom datastore supporting Riak database.

Thanks,
Maciej


Top
 Profile  
 
 Post subject: Re: datasource properties on server
PostPosted: Tue Sep 02, 2014 8:57 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Hi Maciej,

Right now there is no equivalent to datasources for NoSQL stores in WildFly.

For the time being, you can try the following to separate the configuration of credentials from your deployment unit:

* Create system properties for the required settings, e.g. by adding the following to your standalone.xml (see http://www.mastertheboss.com/jboss-configuration/how-to-inject-system-properties-into-jboss for some background information):

Code:
...
<system-properties>
    <property name="MONGODB_HOST" value="ADDRESS_OF_MY_HOST"/>
</system-properties>
...


* In your persistence.xml, refer to these properties like this:

Code:
...
<properties>
   <property name="hibernate.ogm.datastore.host" value="${MONGODB_HOST}" />
</properties>
...


Hibernate will then pull the value for this property from the system property configured in the environment.

Hope this gets you going. Let me know in case you run into any issues.

Quote:
I am using WildFly 8.1 and Hibernate OGM 4.1.0.Beta1 with custom datastore supporting Riak database.


That's very interesting. So you have created your custom GridDialect for Riak? Would you be interested in contributing it as a module to the OGM project? Btw. I also can recommend to upgrade to the latest Beta, there have been done many improvements since Beta1.

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
 Post subject: Re: datasource properties on server
PostPosted: Wed Sep 17, 2014 7:49 am 
Newbie

Joined: Mon Sep 01, 2014 2:23 am
Posts: 5
Hi,
it worked! Very nice workaround. Thanks!

Gunnar wrote:
So you have created your custom GridDialect for Riak? Would you be interested in contributing it as a module to the OGM project? Btw. I also can recommend to upgrade to the latest Beta, there have been done many improvements since Beta1.


Yes, I actually thought about it.
GridDialect which I've implemented supports Riak 1.4.x right now. There are still some missing features like native queries or id generation support. I skipped them because there are some known issues with Riak 1.4.x itself. Recently however Riak 2.0 has been released which comes with new interesting concepts and significant improvements of existing mechanisms, e.g. full text search. Next month probably I will try to find some time give support for it too.

Thanks,
Maciej


Top
 Profile  
 
 Post subject: Re: datasource properties on server
PostPosted: Fri Nov 25, 2016 6:35 am 
Newbie

Joined: Fri Nov 25, 2016 6:02 am
Posts: 1
Hi,

I'd like to ask whether anything changed in this subject - OGM specyfic configuration properties in JBoss/WildFly <datasource> node:
* host
* user
* password
etc

since your workaround hist posted in 2014?

Cheers
Mariusz


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.