I want to property in entity seam. But I dont want to create column in database. for example my entity is ;
@Entity
public class Category extends Item implements Serializable {
private static final long serialVersionUID = -1154500438874768209L;
private List<Product> example;
private List<Item> children;
public void addChild(Item child) {
if (children == null) {
children = new ArrayList<Item>();
}
if (!children.contains(child)) {
children.add(child);
}
}
@OneToMany(cascade = CascadeType.ALL)
public List<Item> getChildren() {
return children;
}
public void setChildren(List<Item> children) {
this.children = children;
}
public void setExample(List<Product> example) {
this.example = example;
}
publ开发者_C百科ic List<Product> getExample() {
return example;
}
}
in this entity children list is mapping database but I dont want to map example list in database. Hown can i do?
thx .
If you don't want to persist a property of a class in Seam (Hibernate), annotate that property, either on the property itself or on the getter with the @Transient annotation. i.e.
@Transient
public List<Product> getExample() {
return example;
}
精彩评论