Re: Mixing ActiveRecord classes and Java Classes

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 M. (Guest)
on 2012-03-22 01:57
[image: (Received via mailing list)]

On Mar 21, 2012, at 12:36 PM, Samer A. 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-any-ruby-object-feel-like-activerecord/

ex.

include_class ‘org.aps.eop.model.manuscript.Journal’

class Journal
class << self

end

-lenny