-
Notifications
You must be signed in to change notification settings - Fork 366
added hibernate example #271
base: master
Are you sure you want to change the base?
Conversation
uh wow, could you please
for a start? Right now, the changeset contains way too much noise to see the actual changes. |
exclude the target folder make modules a symlink
Ok i think thats it (new to github) |
Much smaller :) Do you think you could also remove all other clutter that is not needed by the JPA example (e.g. views, test base classes, etc.) to make it even smaller? |
I think this is as small as i can make it, unless you can see anything else obvious? :) |
Looking at adding a session factory rather than the developer having to call em.close() - will let you know how i get on. |
Using session factory over entity manager has the same effect, the developer is responsible for closing sessions. I also looked at an example that uses a proxy to create a session for each transaction request, releasing it when commit is called. The code is more maintainable, but it does not support lazy loading. There is also the issue of only one session running on the main thread that could create a bottleneck/concurrency issues. The code can be seen here if interested: https://github.com/skelt/play-authenticate-hibernate/tree/session-factory So it looks like the latest commit is the preferred option due to it being fully JPA compliant and thread safe. The only issue is you can't really use @transactional with this, it will only works if there are no nested transactions. |
I think the amount of duplicated code from the main sample is still too high - if we merged this, it would get update hell at some point in time. I wonder if it would be better to extract the samples from the main repository into its own repos, where these can be forked and then adapted (so in the case of hibernate, only the changed and new files would need to be checked in, everything else would come from upstream). What do you think @mkurz ? |
tables preventing unnecessary transactions
Added an example for JPA