Yep, all done.
Marek is working on import/export, but he'll need to update that to work with the
changes you do to the model so that can be committed after you've finished.
----- Original Message -----
From: "Bill Burke" <bburke(a)redhat.com>
To: "Stian Thorgersen" <stian(a)redhat.com>
Cc: keycloak-dev(a)lists.jboss.org
Sent: Monday, 14 July, 2014 2:35:21 PM
Subject: Re: [keycloak-dev] JPA connections provider and multiple transaction support
So, are you guys done with your model work? I can do dig into it now
without worrying that it will change entirely in between work days?
On 7/14/2014 5:19 AM, Stian Thorgersen wrote:
> Committed the final changes to UserProvider, including working Mem, JPA and
> Mongo implementations.
>
> Also, added the JPA and Mongo Connection Providers. With the connection
> providers we can now have a single EntityManager instance shared between
> ModelProvider (and UserProvider when ready), UserSessionProvider and
> Audit.
>
> Had to change the multiple-transaction stuff that was added to master
> because with the connection providers the model (and others) do not
> actually start a transaction themselves. Transactional providers are now
> required to enlist a transaction if they want to, this won't be common to
> do as they should use the connection providers which will do it for them.
>
> ----- Original Message -----
>> From: "Stian Thorgersen" <stian(a)redhat.com>
>> To: "Bill Burke" <bburke(a)redhat.com>
>> Cc: keycloak-dev(a)lists.jboss.org
>> Sent: Monday, 14 July, 2014 9:13:44 AM
>> Subject: Re: [keycloak-dev] JPA connections provider and multiple
>> transaction support
>>
>> I had this working, including sharing Jpa/Mongo connection providers.
>> Which I
>> sent out an email to get feedback for......
>>
>> ----- Original Message -----
>>> From: "Bill Burke" <bburke(a)redhat.com>
>>> To: keycloak-dev(a)lists.jboss.org
>>> Sent: Saturday, 12 July, 2014 12:42:07 AM
>>> Subject: Re: [keycloak-dev] JPA connections provider and multiple
>>> transaction support
>>>
>>> Ok, I committed something.
>>>
>>> * KeycloakSession keeps track of enlisted provider KeycloakTransactions.
>>> * KeycloakSession.getTransaction().commit() and rollback() will iterate
>>> these enlisted transactions
>>> * getProvider() just returns a provider
>>> * model() and sessions() creates a ModelProvider or UserSessionProvider
>>> and enlists their transactions.
>>> * model() and sessions() throw IllegalStateException if
>>> KeycloakSession.transaction hasn't started yet.
>>> * KeycloakSession has an enlist() method.
>>>
>>>
>>>
>>>
>>>
>>> On 7/11/2014 6:11 PM, Bill Burke wrote:
>>>> Actually I think there is a better way.
>>>>
>>>> public interface TransactionManaged {
>>>>
>>>> KeycloakTransaction getTransaction();
>>>> }
>>>>
>>>> public interface KeycloakSession implements TransactionManaged {}
>>>> public interface UserProvider implements TransactionManaged{}
>>>>
>>>> etc.
>>>>
>>>>
>>>> KeycloakSession.getProvider() will check to see if the provider is
>>>> transaction managed. If KeycloakSession has an active transaction,
then
>>>> a transaction will be created for that provider and registered with an
>>>> internal TM.
>>>>
>>>>
>>>>
>>>>
>>>> On 7/11/2014 3:52 PM, Bill Burke wrote:
>>>>> Please get this in. I can't finish with UserProvider split
until you
>>>>> do.
>>>>>
>>>>> On 7/11/2014 8:29 AM, Stian Thorgersen wrote:
>>>>>> To prevent creating multiple EntityManager's for a single
request I've
>>>>>> added a JPAConnectionProvider that is used to share an
EntityManager
>>>>>> instance between multiple providers.
>>>>>>
>>>>>>
https://github.com/stianst/keycloak/blob/master/connections/jpa/src/main/...
>>>>>>
https://github.com/stianst/keycloak/blob/master/connections/jpa/src/main/...
>>>>>>
>>>>>> In the future we could consider adding support for multiple
>>>>>> persistence-units, but for now I think we should have a
limitation
>>>>>> that
>>>>>> all JPA providers use the same database/persistence-unit.
>>>>>>
>>>>>> I've also added some very basic support to KeycloakSession
so
>>>>>> providers
>>>>>> can enlist their transactions with the session:
>>>>>>
>>>>>>
https://github.com/stianst/keycloak/blob/master/model/api/src/main/java/o...
>>>>>>
https://github.com/stianst/keycloak/blob/master/model/api/src/main/java/o...
>>>>>>
>>>>>> The idea being that a provider when used can enlist its
transaction
>>>>>> with
>>>>>> the session.
>>>>>>
>>>>>> I've not committed any of this to master as I wanted to
have
>>>>>> everyone's
>>>>>> opinion on it first.
>>>>>> _______________________________________________
>>>>>> keycloak-dev mailing list
>>>>>> keycloak-dev(a)lists.jboss.org
>>>>>>
https://lists.jboss.org/mailman/listinfo/keycloak-dev
>>>>>>
>>>>>
>>>>
>>>
>>> --
>>> Bill Burke
>>> JBoss, a division of Red Hat
>>>
http://bill.burkecentral.com
>>> _______________________________________________
>>> keycloak-dev mailing list
>>> keycloak-dev(a)lists.jboss.org
>>>
https://lists.jboss.org/mailman/listinfo/keycloak-dev
>>>
>> _______________________________________________
>> keycloak-dev mailing list
>> keycloak-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/keycloak-dev
>>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com