четверг, 3 февраля 2011 г.

GWT. Collection fields

For example, you have something like:

@Entity
public class Contact {
...
@OneToMany(mappedBy="contact", targetEntity=Tag.class, fetch=FetchType.EAGER)
private List tags;
...
}

On first look, when you fetching contacts, their 'tags' fields should be already prepopulated... as they annotated as eager... But then you'll try to execute something like:

requestFactory.contactRequest().findAllContacts().fire(lastDataReceiver);

all 'tags' will be NULL.

To fetch collection fields together with parent entity you have to use:
requestFactory.contactRequest().findAllContacts().with("tags").fire(lastDataReceiver);

Комментариев нет:

Отправить комментарий