I think you should stick to JPA as far as possible to be more independent.
You can always cheat and get the Hibernate session by doing things like:
if (this.entityManager.getDelegate() instanceof
org.hibernate.Session) {
org.hibernate.search.FullTextSession fts =
org.hibernate.search.Search.createFullTextSession(((org.hibernate.Session)
this.entityManager.getDelegate()));
}
I think JPA doesn't have something like a Criteria API. Also leveraging
Hibernate Search is nice (like in the example above). You should get along
with the hack above, although it's been quite some time since I used
Hibernate/JPA.
Having done Rails for the last couple of months, this is what I'm thinking
about comparing Hibernate and ActiveRecord/Rails:
- I like migrations a lot, although I initially thought it's more effort
creating them compared to simply adding the property/annotation in the Java
model.
- I really miss Hibernate's second level cache (aka object cache)
- I don't like HQL/JQL any longer. Working with SQL in Rails feels so much
more natural to me
- The lack of something like a Hibernate session makes working with
ActiveRecord quite different in many cases. In the beginning I got bitten
quite often by the fact that you actually have to reload models all the time
to see changes. I'm torn here: Having such a persistence context is a good
thing performance-wise (applications tend to be less chatty with the db),
but it's another abstraction you have to understand as user.
Bottom line: ActiveRecord and Hibernate are quite different. Hibernate is
much more complex (but more powerful, too). This is why I think something
like ActiveHibernate will be adopted mainly by folks coming from Java - but
maybe (and hopefully) I'm wrong here.
Ola Bini-3 wrote:
>
> Hi friends,
>
> - should it be based on ActiveHibernate, or from scratch? JRuby API
> changes speak for the latter
> - should it in fact be Hibernate or JPA?
> - how close should it be to the ActiveRecord API?
> - should there be any feature for migrations?
> - should properties be declared in the common case?
>
> If I don't get any good conclusions from the list I'll proceed with what
> feels best in my opinion (so you are now officially warned).
>
> Let the flames begin! =)
>
> --
> Ola Bini (http://ola-bini.blogspot.com)
> JRuby Core Developer
> Developer, ThoughtWorks Studios (http://studios.thoughtworks.com)
> Practical JRuby on Rails (http://apress.com/book/view/9781590598818)
>
> "Yields falsehood when quined" yields falsehood when quined.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
>
--
View this message in context:
http://www.nabble.com/Hibernate-tp19053976p19069981.html
Sent from the JRuby - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email