Workaround for Hibernate relationships and SmartGWT RESTDataSources

I'm lost with the way I have to implement a ManyToMany relationship defined in Hibernate. In the client-side we're using SmartGWT LGPL version with RESTDataSources working fine against some back-end webservices.

The relationship is made between a typical Role and Permissions. In Rol.class:

@JoinTable(name = "ROL_PERMISO", joinColumns = @JoinColumn(name = "ROL_ID"), inverseJoinColumns = @JoinColumn(name = "PERMISO_ID"))
private Set<Permiso> permisos;

In the client side I have two 'views'. The first one is for permission's management. The another one is for role management, which has a ListGrid showing roles and a DynamicForm with a permissions CheckBoxTree to select the permissions associated to the role, and other fields like name and description.

How I stablish the relationship between roles and permissions in the DataSources? Any recommended workaround?


After searching on it I've solved that using nested DataSource:

In Rol DataSource:

// One to Many relationship
DataSourceField permisos = new DataSourceField("permisos", FieldType.TEXT, locale.permisos());

The key is create a DatSourceField and set the type as DataSource. And then, for accessing the data you can use getAttributeAsRecordArray("permisos") in a record of Rol DataSource

Hope this help someone!

Need Your Help

Best way to save data on the iPhone

iphone objective-c

I am writing an iPhone application, and need to save the state of my application (5K or so).

How mature is Ebean or Siena?

java orm persistence siena ebean

In the last time I heard a lot of complaining about hibernate. And indeed I have some painful experiences with hibernate too. So I read about Ebean and Siena.

CakePHP AJAX request not recognized

php jquery ajax cakephp

I'm trying to create a favorite/star/heart button (like in Gmail) for each item on a list of elements in CakePHP 2.2.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.