My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
GettingStarted  

Introduction

dpHibernate is designed to quietly work behind the scenes and make everything as seamless as possible. However in order for us to do this we do need to know which objects we need to manage. This is done with the Managed metadata and a simple extends added to every value object/pojo class.

Setup and Configuration

Before you start make sure you have followed the setup and configuration instructions defined here: Setup

Actionscript

In order for dpHibernate to be able to monitor the state of your objects and trigger the lazy loading as objects are touched. Two things need to be done to every value object in Action Script.

  1. Add the Managed meta data flag to each class
  2. Every value object, returned from Hibernate, that needs to be monitored and managed by dpHibernate needs to extend the HibernateBean (net.digitalprimates.persistence.hibernate.HibernateBean) class
    • Alternativly every value object can implement the IHibernateBean interface instead. (net.digitalprimates.persistence.hibernate.HibernateBean)
package model.beans
{
	import mx.collections.ArrayCollection;
	import net.digitalprimates.persistence.hibernate.HibernateBean;
	
	[RemoteClass(alias="net.digitalprimates.samples.sample1.beans.User")]
	[Managed]
	public class User extends HibernateBean
	{
		public var id:String;
		public var firstName:String;
		public var lastName:String;
		public var addresses:ArrayCollection;
		public var connectInfo:UserConnectInfo;
	}
}

Java

dpHibernate works by passing either the real object or a proxy back and forth with flex. For this reason the POJO's on the Java side, which will be returned by hibernate, need to be able to live as both a proxy and the full object.

  • Extend the POJO classes with the: HibernateProxy (net.digitalprimates.persistence.hibernate.proxy.HibernateProxy)
    • Alternatively you can implement the interface: IHibernateProxy (net.digitalprimates.persistence.hibernate.proxy.IHibernateProxy)
Comment by robert.b...@gmail.com, Apr 15, 2008

3) Replace the regular mx:RemoteObject? with dp:HibernateRemoteObject?

ps. for all who are somewhat lost there are samples in the project svn repository

Comment by rpf...@gmail.com, May 2, 2008

Managed? and extends HibernateBean?!?

The better is only a code annotated with Managed?.

Such a Plain ActionScript? Class

+)

Comment by faisal.a...@gmail.com, May 21, 2008

AFAIK Blazeds does not support Managed? objects, its part of LCDS.

Comment by johndalf, May 22, 2008

It appears that the Managed? designation mentioned here is implemented by the dpHibernate library.

Comment by koli...@gmail.com, Apr 11, 2009

Anybody has experience with this library and BlazeDS (not LCDS)? Is it useful for production website? I am wondering particulary Flex ArrayCollection? persistence mapping to database. Thank you.

Comment by wwwisexp...@gmail.com, Jun 19, 2009

there is no interface called "IHibernateBean", it may be wrong typed, and it should be "IHibernateProxy"

Comment by eman.nollase@gmail.com, Jan 5, 2010

im trying to call method in "save" in userService but it is entering java service.

this.userService = new HibernateRemoteObject??(); this.userService.destination = "userService";

var call:AsyncToken?? = userService.save(user);

other method is like loadAll, remove, update is working but "save" is not entering in the service (java side). any idea?

thanks a lot. cheers.


Sign in to add a comment
Powered by Google Project Hosting