Forum: JRuby Re: Mixing ActiveRecord classes and Java Classes

Posted by Brian Walsh (bwalsh)
on 2012-11-01 06:54
(Received via mailing list)
>We keep all persistence for those models through Hibernate,

Can you share how you accomplished this?  An ActiveRecord wrapper around
hibernate?

-b



Posted by Lenny Marks (Guest)
on 2012-03-22 01:57
[image: (Received via mailing list)]

On Mar 21, 2012, at 12:36 PM, Samer Abukheit wrote:
> User.active_record_method>> Maybe something like java_include from the 
ActiveRecord class, or> maybe make the ruby class inherits from the java class and 
then add> the ActiveRecord functionality some other way.

Is persistence for your java User class already managed by another ORM
like Hibernate? It would smell pretty bad to me having persistence for a
single entity(one table) implemented across multiple ORMs.  We have a
core set of domain model classes implemented via Java/Hibernate. We keep
all persistence for those models through Hibernate, but freely add new
behavior to them by extending the extending/re-opening them in ruby. You
can still reap many of the ActiveRecord goodness like validation macros
by mixing in ActiveModel stuff.
http://yehudakatz.com/2010/01/10/activemodel-make-...
<http://yehudakatz.com/2010/01/10/activemodel-make-...

ex.

include_class 'org.aps.eop.model.manuscript.Journal'

class Journal
  class << self
  ...
  end
  ....

-lenny
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.