Short version:
What's the right way to View & Model lists of Hibernate data that
are not Entities (@CollectionsOfElements) and already loaded via
an Entity?
What if they are Entities, but are already loaded via another Entity
(@OneToMany)?
Long version:
Absorbing the mantra "ListView is bad for database data", I was looking into
converting some ListViews into DataViews. But these list items are
not Hibernate
Entities. They're CollectionsOfElements belonging to an Entity.
@Entity
class Foo
{
@org.hibernate.annotations.CollectionOfElements
private Collection<User> users = new ArrayList<User>();
...
}
So the example
class UsersProvider implements IDataProvider
{
public Iterator iterator(int first, int count)
{
((MyApplication)Application.get()).getUserDao().iterator(first,
count);
}
public int size()
{
((MyApplication)Application.get()).getUserDao().getCount();
}
public IModel model(Object object)
{
return new DetachableUserModel((User)object);
}
}
doesn't really fit. My "Users" are a list hanging off an Entity that is
loaded from the database. My "Users" don't have a unique ID for
their own DetachableUserModel.
So, should I create an IDataProvider that references the higher
level Entity Foo? Or should I stick with ListView and ::setList()
(after Foo's LDM refreshes the list)? Something else?
Is the answer the same when the data *are* Entities, but are already
loaded via the LDM of another Entity?
@Entity
class Foo
{
@OneToMany
private Set<OtherEntity> = new TreeSet<OtherEntity>();
...
}
Thanks,
-troy
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]