[EJB 3.0] - ejb 3.0 lazy loading no session
by stephan.opitz
in my ejb i have such a construct...
private long productsId;
private List categories;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "products_id")
public long getProductsId() {
return productsId;
}
public void setProductsId(long productsId) {
this.productsId = productsId;
}
@ManyToMany
@JoinTable(name = "products_categories", joinColumns = @JoinColumn(name = "products_id", referencedColumnName = "products_id"), inverseJoinColumns = @JoinColumn(name = "categories_id", referencedColumnName = "categories_id"))
public List getCategories() {
return categories;
}
public void setCategories(List categories) {
this.categories = categories;
}
i get a list with content from db...
but if i want to access the list... :-(
Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role:... , no session or session was closed
what should i change...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961720#3961720
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961720
17 years, 11 months
[EJB 3.0] - EJB 3.0 help - joining
by stephan.opitz
i have two tables:
categories_id BIGINT(20) NOT NULL,
image VARCHAR(45) NOT NULL,
parent_categories_id BIGINT(20) NOT NULL,
sort_order INTEGER(3) NOT NULL,
last_modified DATETIME NOT NULL,
timestamp DATETIME NOT NULL,
PRIMARY KEY(categories_id)
);
CREATE TABLE categories_lang (
categories_id BIGINT(20) NOT NULL,
languages_id BIGINT(20) NOT NULL,
name VARCHAR(45) NOT NULL,
description TEXT NOT NULL,
PRIMARY KEY(categories_id, languages_id)
);
in categoriesLang the languages_id is given...
is it possible to get the specific language data while creating query for categories table... or have i ask second table in second query
stephan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961714#3961714
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961714
17 years, 11 months