You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Cesar Lugo <ce...@sisorg.com.mx> on 2016/05/05 18:33:14 UTC

RE: Multi-Database

Hello. 

I was just wondering if this solution will consider 2 phase commit, so if I create a transaction in Apache ISIS (which I understand are automatically managed) that involves entity A in database A and entity B in database B with mutable values in both (updating the values of some fields from both entities in both databases), it either commits or rolls back the entire transaction in both databases. Is this the way it works?

-----Original Message-----
From: Kambiz Darabi [mailto:darabi@m-creations.com] 
Sent: Thursday, April 28, 2016 6:57 AM
To: Guilherme541 Gamer
Cc: users@isis.apache.org
Subject: Re: Multi-Database

Hi Moacir,

we worked on the same problem recently and have a moderately working solution, but it involved a patch to DataNucleus itself.

This is how an entity is annotated:

@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "subscription_service", table = "subscribers") @Extension(vendorName = "datanucleus", key = "datastore", value = "store-subscription") ...
public class Subscriber ...

Note the 'datastore' key with value 'store-subscription'.

Matching to that value, we have this in persistor_datanucleus.properties:

isis.persistor.datanucleus.impl.datanucleus.datastore.store-subscription=persistor_subscription.properties

and finally the file persistor_subscription.properties which contains the usual:

javax.jdo.option.ConnectionDriverName=com.mysql.jdbc.Driver
javax.jdo.option.ConnectionURL=jdbc:mysql://localhost:3306/subscription_service
javax.jdo.option.ConnectionUserName=root
javax.jdo.option.ConnectionPassword=tiger


This is the branch containing the commit which we have tested with
datanucleus-core-4.1.2 and 4.1.7:

https://github.com/m-creations/datanucleus-core/commits/mcreations-federatedstoremanager

If you are interested in trying it out and don't want to build datanucleus-core yourself, I could release a patched 4.1.7 version which is compatible with Isis 1.12.1.

Hope this helps


Kambiz


On 2016-04-27 15:06 CEST, Guilherme541 Gamer <mo...@gmail.com> wrote:

> Sorry for bad english. In fact I want to know how to connect a 
> particular entity A in a database A and another entity B in another 
> database B. I ask again apologize for the e-mail nickname , my son 
> changed. I have been using APACHE ISIS framework on health systems in 
> my city because I am a public agent in Brasil city Porto Velho - 
> Rondônia. I implemented the records only for patients SUS card, a benefit given by the Brazilian government.
> Grateful for your attention.
>
>
> Moacir Bishop Camata


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


Re: Multi-Database

Posted by Kambiz Darabi <da...@m-creations.com>.
Hi Cesar,

to be honest, I haven't checked the exact commit behaviour, but I will
enable detailed logging and run some tests. Then I'll get back to you.

Cheers


Kambiz

On 2016-05-05 20:33 CEST, Cesar Lugo <ce...@sisorg.com.mx> wrote:

> Hello. 
>
> I was just wondering if this solution will consider 2 phase commit, so
> if I create a transaction in Apache ISIS (which I understand are
> automatically managed) that involves entity A in database A and entity
> B in database B with mutable values in both (updating the values of
> some fields from both entities in both databases), it either commits
> or rolls back the entire transaction in both databases. Is this the
> way it works?
>
> -----Original Message-----
> From: Kambiz Darabi [mailto:darabi@m-creations.com] 
> Sent: Thursday, April 28, 2016 6:57 AM
> To: Guilherme541 Gamer
> Cc: users@isis.apache.org
> Subject: Re: Multi-Database
>
> Hi Moacir,
>
> we worked on the same problem recently and have a moderately working solution, but it involved a patch to DataNucleus itself.
>
> This is how an entity is annotated:
>
> @PersistenceCapable(identityType = IdentityType.DATASTORE, schema =
> "subscription_service", table = "subscribers") @Extension(vendorName =
> "datanucleus", key = "datastore", value = "store-subscription") ...
> public class Subscriber ...
>
> Note the 'datastore' key with value 'store-subscription'.
>
> Matching to that value, we have this in persistor_datanucleus.properties:
>
> isis.persistor.datanucleus.impl.datanucleus.datastore.store-subscription=persistor_subscription.properties
>
> and finally the file persistor_subscription.properties which contains the usual:
>
> javax.jdo.option.ConnectionDriverName=com.mysql.jdbc.Driver
> javax.jdo.option.ConnectionURL=jdbc:mysql://localhost:3306/subscription_service
> javax.jdo.option.ConnectionUserName=root
> javax.jdo.option.ConnectionPassword=tiger
>
>
> This is the branch containing the commit which we have tested with
> datanucleus-core-4.1.2 and 4.1.7:
>
> https://github.com/m-creations/datanucleus-core/commits/mcreations-federatedstoremanager
>
> If you are interested in trying it out and don't want to build datanucleus-core yourself, I could release a patched 4.1.7 version which is compatible with Isis 1.12.1.
>
> Hope this helps
>
>
> Kambiz
>
>
> On 2016-04-27 15:06 CEST, Guilherme541 Gamer <mo...@gmail.com> wrote:
>
>> Sorry for bad english. In fact I want to know how to connect a 
>> particular entity A in a database A and another entity B in another 
>> database B. I ask again apologize for the e-mail nickname , my son 
>> changed. I have been using APACHE ISIS framework on health systems in 
>> my city because I am a public agent in Brasil city Porto Velho - 
>> Rondônia. I implemented the records only for patients SUS card, a benefit given by the Brazilian government.
>> Grateful for your attention.
>>
>>
>> Moacir Bishop Camata
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus