Need help with Hibernate? Read this first
In hibernate webrowsets can be useful or not. right know i am doing project on hibernate .i am follwing hibernate in action book. in this we donot mention about webrowsete i want clear clarification about webrowsets can be useful in hibernate or anyother alternativies is there if there ple tell me. Right know i am doing project on hibernate.in this hibernate action donot mention about security i want more information about the sequrity plese telll me in datails any examples plese provide me. how to develop pagination concept in hibernate. and also how to develop programatic serurity.i am using hibernate 3.o struts 1.1 oracle 9i here i am putting my example on hibernate for crud oeration but in yhis example i developed inser,update,and delete i didnot develop list i anyone knows plese help me and also telll hoe to develop beteer way.and also in this example i hardcoded for one table but i want dynamically when i select table on gui according to that crud operations must be done.
And alsio in this example i didnot developed paginaton concept plese if y know tellll me how to develop
my id
satyanarayana@ebaseinteractive.com
my mobile +91 9866636789
first ideveloped one interface
package com.ebaseindia.valuesys.handling_data.tables.actions;
public class Table
{
public void setName(String name){
this.name=name;
}
public String getName(){
return name;
}
public void setNumber(int number){
this.number=number;
}
public int getNumber(){
return number;
}
private String name;
int number;
}
next this interface is developed u
package com.ebaseindia.valuesys.handling_data.tables.actions;
public class Table
{
public void setName(String name){
this.name=name;
}
public String getName(){
return name;
}
public void setNumber(int number){
this.number=number;
}
public int getNumber(){
return number;
}
private String name;
int number;
}
i hard coded for one table thats way i written
package com.ebaseindia.valuesys.handling_data.tables.actions;
public class Table
{
public void setName(String name){
this.name=name;
}
public String getName(){
return name;
}
public void setNumber(int number){
this.number=number;
}
public int getNumber(){
return number;
}
private String name;
int number;
}
i developed select table Action class
package com.ebaseindia.valuesys.handling_data.tables.actions;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.actions.DispatchAction;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.ebaseindia.valuesys.handling_data.tables.ISelectTable;
import com.ebaseindia.valuesys.handling_data.tables.forms.InsertTableForm;
import com.ebaseindia.valuesys.handling_data.tables.forms.SelectTableForm;
public class SelectTableAction extends DispatchAction
{
public ActionForward insert(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionErrors errors = new ActionErrors(); // for errors
ActionForward forward = new ActionForward(); // return value
String target="fail";
System.out.println("before try");
try{
SelectTableForm stForm=(SelectTableForm)form;
HttpSession session = request.getSession();
String tableName = stForm.getTableName();
session.setAttribute("tableName",tableName);
ISelectTable ist=new SelectTableImpl();
java.util.List tableFields=ist.getRows();
int max=0;
for(int i=0;i<tableFields.size();i++){
if( max<((Table)tableFields.get(i)).getNumber())
max=((Table)tableFields.get(i)).getNumber();
}
session.setAttribute("id",new Integer(max+1));
//session.setAttribute("tableFields",tableFields);
return mapping.findForward("insert");
}catch(Exception e){
System.out.println("in cathc");
e.printStackTrace();
errors.add("error",new ActionError("errorID"));
}
forward=new ActionForward(target);
return forward;
}
public ActionForward update(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionErrors errors = new ActionErrors(); // for errors
ActionForward forward = new ActionForward(); // return value
String target="fail";
System.out.println("before try");
try{
SelectTableForm stForm=(SelectTableForm)form;
HttpSession session = request.getSession();
String tableName = stForm.getTableName();
session.setAttribute("tableName",tableName);
ISelectTable ist=new SelectTableImpl();
java.util.List tableFields=ist.getRows();
session.setAttribute("tableFields",tableFields);
return mapping.findForward("update");
}catch(Exception e){
System.out.println("in cathc");
e.printStackTrace();
errors.add("error",new ActionError("errorID"));
}
forward=new ActionForward(target);
return forward;
}
public ActionForward delete(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionErrors errors = new ActionErrors(); // for errors
ActionForward forward = new ActionForward(); // return value
String target="fail";
System.out.println("before try");
try{
SelectTableForm stForm=(SelectTableForm)form;
HttpSession session = request.getSession();
String tableName = stForm.getTableName();
session.setAttribute("tableName",tableName);
ISelectTable ist=new SelectTableImpl();
java.util.List tableFields=ist.getRows();
session.setAttribute("tableFields",tableFields);
return mapping.findForward("delete");
}catch(Exception e){
System.out.println("in cathc");
e.printStackTrace();
errors.add("error",new ActionError("errorID"));
}
forward=new ActionForward(target);
return forward;
}
}
remaining i developed corresponding Acionforms And action class(INsert,update, delete)
correesponding jsps any one knows tel me
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0
Mapping documents:3.0
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:oracle 9i
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Code:
Code:
Code:
Code:
[quote][/quote]