Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Updates two database servers in one take

Hi Edson, I'm not sure if you're still playing with this
functionality, but here is a little more info for you.  You have
defined a property in your persistence unit via persistence.xml:
<property name="eclipselink.partitioning" value="ReplicationPartitioning"/>

This refers to a named "partition policy" but you also need to setup a
partition policy with this name.  It can probably be done with a
session customizer, but the examples I've seen define the policy via
an annotation on a jpa entity class... like this:

@ReplicationPartitioning(name = "replicate", connectionPools =
{"default", "node2"})

This assumes you want to replicate to connection pools named "default"
and "node2"

I've also read that you can define this policy in an orm.xml file
instead of using annotations, but I've not looked too closely at it.

I'm still evaluating the best scheme for applying replication to all
entities within a persistence unit, and I'll post more info after I
play some more.

Hope that helps!
- Phillip

On Tue, Apr 14, 2015 at 4:21 PM, Edson Richter <edsonrichter@xxxxxxxxxxx> wrote:
> Yes, I've read both of them. Most of available examples show partitioning
> using annotations, but I just want to enable ReplicationPartitioning - which
> seems to not require nothign special, but three properties in persistence
> unit XML.
>
> Remains the question: when enabling "ReplicationPartitioning" in persistence
> unit, why EntityManagerFactory creation throws error "Missing partitioning
> policy for name". How can I fix it?
>
> This is my latest persistence unit:
>
> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
>   <persistence-unit name="TestePU" transaction-type="RESOURCE_LOCAL">
> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
> <non-jta-data-source>java:comp/env/jdbc/teste</non-jta-data-source>
> <exclude-unlisted-classes>false</exclude-unlisted-classes>
>     <shared-cache-mode>ALL</shared-cache-mode>
>     <validation-mode>NONE</validation-mode>
>     <properties>
>       <property name="eclipselink.partitioning"
> value="ReplicationPartitioning"/>
>       <property name="eclipselink.connection-pool.default.nonJtaDataSource"
> value="java:comp/env/jdbc/teste"/>
>       <property name="eclipselink.connection-pool.node2.nonJtaDataSource"
> value="java:comp/env/jdbc/teste2"/>
>     </properties>
>   </persistence-unit>
>
> Atenciosamente,
>
> Edson Carlos Ericksson Richter
>
> On 14-04-2015 16:55, Lukas Jungmann wrote:
>>
>> On 4/14/15 9:11 PM, Edson Richter wrote:
>>>
>>> I can't find correct documentation for this feature.
>>> I think this cannot be used, since the only available example doesn't
>>> work at all, and the "Example page" in documentation is a broken link with
>>> error 404 (page not found).
>>
>>
>> some pointers, not sure how useful they will be:
>> https://wiki.eclipse.org/EclipseLink/Examples/JPA/Partitioning
>>
>> http://java-persistence-performance.blogspot.cz/2011/05/data-partitioning-scaling-database.html
>>
>> HTH,
>> --lukas
>>>
>>>
>>> Atenciosamente,
>>>
>>> Edson Carlos Ericksson Richter
>>>
>>> On 13-04-2015 17:02, Edson Richter wrote:
>>>>
>>>> Please, could someone point out how to configure Replication policy in
>>>> the persistence unit?
>>>>
>>>> Atenciosamente,
>>>>
>>>> Edson Carlos Ericksson Richter
>>>>
>>>> On 12-04-2015 14:57, Phillip Ross wrote:
>>>>>
>>>>> Edson, I'm not sure if this is what you're looking for, but
>>>>> Eclipselink supports "partitioning" which I believe also has
>>>>> replication functionality:
>>>>>
>>>>> http://www.eclipse.org/eclipselink/documentation/2.5/solutions/scaling002.htm#BABHHAEJ
>>>>>
>>>>> hope that helps!
>>>>> - Phillip
>>>>>
>>>>>
>>>>> On Sun, Apr 12, 2015 at 10:55 AM, Edson Carlos Ericksson Richter
>>>>> <edsonrichter@xxxxxxxxxxx> wrote:
>>>>>>
>>>>>> It is possible to configure eclipselink in the following way:
>>>>>>
>>>>>> 1) Every query is send to one "master" server;
>>>>>> 2) Every transaction causes insert/update/delete/procedure call to be
>>>>>> send
>>>>>> in two-phase commit mode to 2~4 servers?
>>>>>>
>>>>>> - I don't have problems with volatile functions (like "now()") because
>>>>>> I do
>>>>>> all of this at Java app level. All my functions are predictable
>>>>>> stable.
>>>>>> - I want to use this a alternative to applying HA-jdbc or C-jdbc proxy
>>>>>> libraries.
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Edson
>>>>>>
>>>>>> _______________________________________________
>>>>>> eclipselink-users mailing list
>>>>>> eclipselink-users@xxxxxxxxxxx
>>>>>> To change your delivery options, retrieve your password, or
>>>>>> unsubscribe from
>>>>>> this list, visit
>>>>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>>>>
>>>>> _______________________________________________
>>>>> eclipselink-users mailing list
>>>>> eclipselink-users@xxxxxxxxxxx
>>>>> To change your delivery options, retrieve your password, or unsubscribe
>>>>> from this list, visit
>>>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>>>
>>>>
>>>> _______________________________________________
>>>> eclipselink-users mailing list
>>>> eclipselink-users@xxxxxxxxxxx
>>>> To change your delivery options, retrieve your password, or unsubscribe
>>>> from this list, visit
>>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>>
>>>
>>> _______________________________________________
>>> eclipselink-users mailing list
>>> eclipselink-users@xxxxxxxxxxx
>>> To change your delivery options, retrieve your password, or unsubscribe
>>> from this list, visit
>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>
>>
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top