'cannot navigate association field [field] in the SET clause target exceptions'. This happends because TopLink is a little more strict about your Entity Relations.
Example:
You have an entity School that includes an entity adress, and in the same way the adress is identified using an integer adressID.
School Entity
@Entity
class School{
@ID
private int schoolID;
@OneToOne
private Address address;
}
@Entity
class Address{
@ID
private int addressID;
}
If you create this query:
UPDATE School s SET s.address.adressID = :anAddressID
Hibernate will not complain but Toplink will fail. In toplink is mandatory to use the entity object instead the attributes of the entity: The correct query in toplink is:
UPDATE School s SET s.address = :anAddress
In my opinion is better using the entity object and not the ids 'cause you are taking advantage of the object abstraction provided by the persistence provider.
No hay comentarios:
Publicar un comentario