OK, guice-jpa was created after I implemented similar code in several
different projects for the company I work.
Most of the code was created at a time I didn't know much about guice.
So nowadays I don't like some of the decisions I made back then. When
Andrea asked me if I want to contributed the code I thought this would
be the chance to change the things I don't like any more.
But to be honest, I didn't see how to solve it. So I put guice-jpa back
on my todo list and kind of lowered its priority.
Thank you for reminding me to bring it back up to the top of the list.
So the code is working alright. But I don't like how it is working.
1)
As a user of guice-jpa one has to configure the persistence like this:
PersistenceModule pm = new PersistenceModule();
pm.addApplicationManagedPersistenceUnit("myPuName").annotatedWith(MyDB.class);
pm.addApplicationManagedPersistenceUnit("otherPuName").annotatedWith(OtherDB.class);
install(pm);
In guice one normally overrides a method "configure" and writes the
configuration of the module inside this method.
The PersistenceModule on the other hand is configured from the outside
by calling pm.add... I think it would be "guice liker" if the binding of
the persistence units could be done by overriding a method of
PersistenceModule. This would also prevent user from trying to add new
persistence units after the injector was created. Which obviously won't
work...
2)
Inside guice-jpa I make extensive use of bindToInstance. It would be
nice if these bindings could be replaced by normal bindings to classes.
This problem is strongly coupled to the first one. Since I configure the
modules from the outside, I am forced to bind to the configured instance
of the module.
3)
Most of the code is not covered by unit tests.
I put this as the last point because I feel that especially the first
point has the potential to change the code radically. If this will be
the case it is best to write the unit tests together with the code changes.
This is it. If you have time to spear feel free to do whatever you like
with the code.
I am more than happy to discuss any ideas or thoughts. But my calendar
tells me that until November I will not have any time to sit myself in
front of the code and do any serious work.
Regards
Stephan
On 10/13/2013 10:14 PM, Stephan Classen wrote:
Hi Jordi
The code is contributed. I just don't find any time to push it to the
onami repos :(
It is all working. I don't like the way how it the persistence units
are configured.
I will summarize my ideas and thoughts tomorrow. Maybe you can bring
in a new point of view.
If you have spear time, feel free to commit the code from the git repo
to onami.
Greets
Stephan
On 10/11/2013 04:28 PM, Jordi Gerona wrote:
any news on this?
I have some time to spare and I'm tired of dealing with guice-persist
with
multiples modules and the like.
Is this code being contributed? It looks pretty nice!
Cheers,
jordi
On Wed, Jun 5, 2013 at 9:20 AM, Simone Tripodi
<simonetrip...@apache.org>wrote:
Hallo Stephan,
I am very glad you decided to go ahead and following up the discussion
on the Onami dev@ ML - I want to remark here that what we are doing in
Onami is having a real community-driven place where Guice users are
developing Guice extensions :)
So, fantastic that you would like to join, there are 2 small steps
before speaking about code:
* SoftwareGrant: donating software to the ASF requires you submit the
SG[1]
* In order to contribute to ASF projects, it is required you
submit the
ICLA[2]
You can print, sign and send scanned copies to the ASF secretary at
secret...@apache.org.
Please let me know whatever information you need!!!
Many thanks in advance, all the best!
-Simo
[1] http://www.apache.org/licenses/software-grant.txt
[2] http://www.apache.org/licenses/icla.txt
http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi
On Tue, Jun 4, 2013 at 1:44 PM, Stephan Classen <st.clas...@gmx.ch>
wrote:
Hi everybody
My name is Stephan. I recently wrote an unofficial Guice extension [1]
for
persistence supporting easy integration of JSR-317 (JPA 2.0) and
JSR-907
(JTA) using Guice.
Guice brings its own official persistence extension guice-persist. I
decided
to write (yet) another persistence extension because guice-persist
misses
the following:
- support for multiple persistence units (has to be done manually by
wrapping multiple persistence modules in private modules).
- support for container managed persistence units.
- support for distributed transactions (JSR-907 - JTA).
I was recently contacted by Simo if I would be willing to
participate in
the
Onami project.
If you think Onami could use a persistence extension I would be
willing
to
donate the current source and (some of) my spare time to the Onami
project.
Let me know what you think.
Regards Stephan
[1] https://github.com/sclassen/guice-jpa/wiki