You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
I devised a sample category with subcategory module in jsf by eclipse. I made an adding category module without any issue but I couldn't make an adding subcategory under related category . How I can devise addSubcategory() function in SubCategory which is my issue.. Here the code below.
public List getAllcategoriesbyName(String name) {
// TODO Auto-generated method stub
Session session = HibernateUtil.getSessionFactory().openSession();
try {
List<Category> liste = session.createQuery("SELECT c FROM Category C where lower(name)='"+name+"'").list();
liste.toString();
return liste;
} catch (Exception e) {
e.printStackTrace();
}finally {
session.close();
}
return null;
}
SubCategoryMB
public class SubCategoryMB {
SubCategory subcategory = new SubCategory();
private String categoryName;
private List categorylist;
private List subCategoryList;
private Category category= new Category();
public SubCategoryMB() {
// TODO Auto-generated constructor stub
}
public SubCategory getSubcategory() {
return subcategory;
}
public void setSubcategory(SubCategory subcategory) {
this.subcategory = subcategory;
}
public List getCategorylist() {
CategoryDAO cDao = new CategoryDAO();
this.categorylist= cDao.getAllcategoriesSelectItemName();
return categorylist;
}
public void setCategorylist(List categorylist) {
this.categorylist = categorylist;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public List getSubCategoryList() {
SubCategoryDAO subDao = new SubCategoryDAO();
this.subCategoryList= subDao.getAllSubcategories();
return subCategoryList;
}
I devised a sample category with subcategory module in jsf by eclipse. I made an adding category module without any issue but I couldn't make an adding subcategory under related category . How I can devise addSubcategory() function in SubCategory which is my issue.. Here the code below.
Suncategory .xhtml
<h:form>
/h:form
</h:body
Category Dao
public List getAllcategoriesbyName(String name) {
// TODO Auto-generated method stub
Session session = HibernateUtil.getSessionFactory().openSession();
}
SubCategoryMB
public class SubCategoryMB {
SubCategory subcategory = new SubCategory();
private String categoryName;
private List categorylist;
private List subCategoryList;
private Category category= new Category();
public SubCategoryMB() {
// TODO Auto-generated constructor stub
}
public SubCategory getSubcategory() {
return subcategory;
}
public void setSubcategory(SubCategory subcategory) {
this.subcategory = subcategory;
}
public List getCategorylist() {
CategoryDAO cDao = new CategoryDAO();
this.categorylist= cDao.getAllcategoriesSelectItemName();
return categorylist;
}
public void setCategorylist(List categorylist) {
this.categorylist = categorylist;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public List getSubCategoryList() {
SubCategoryDAO subDao = new SubCategoryDAO();
this.subCategoryList= subDao.getAllSubcategories();
return subCategoryList;
}
public void addSubCategory(){
}
}
The text was updated successfully, but these errors were encountered: