mohananasundaramn90's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
14 (0.02 per day)
Joined:
16-July 12
Profile Views:
250
Last Active:
User is offline Aug 02 2012 05:03 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   mohananasundaramn90 has not set their status

Posts I've Made

  1. In Topic: struts with hibernate

    Posted 19 Jul 2012

    Now also trying to retrieve data from database by usin the below coding
    package pack;
    
    import org.hibernate.Query;
    import org.hibernate.SessionFactory;
    import org.hibernate.Session;
    import org.hibernate.Transaction;
    import org.hibernate.cfg.Configuration;
    
    
    import java.util.Iterator;
    
    import com.opensymphony.xwork2.ActionSupport;
    public class VisitorsAction extends ActionSupport{
    	private String username;
    	private String password;
    	SessionFactory sf=null;
    	Session ses=null;
    	Transaction t=null;
    	/**
    	 * @return the username
    	 */
    	public String getUsername() {
    		return username;
    	}
    	/**
    	 * @param username the username to set
    	 */
    	public void setUsername(String username) {
    		this.username = username;
    	}
    	/**
    	 * @return the password
    	 */
    	public String getPassword() {
    		return password;
    	}
    	/**
    	 * @param password the password to set
    	 */
    	public void setPassword(String password) {
    		this.password = password;
    	}
    	public String execute()
    	{
    		this.sf=new Configuration().configure().buildSessionFactory();
    		this.ses=sf.openSession();
    		this.t=ses.beginTransaction();
    		String view=("from bank");
    		Query q=ses.createQuery(view);
    		Iterator tt=q.iterate();
    		while(tt.hasNext())
    		{
    			bank b=(bank)tt.next();
    			String user=b.getUsername();
    			System.out.println(user);
    		}
    
    		
    		t.commit();
    		ses.close();
    		return SUCCESS;
    	}
    
    }
    



    But I got The Error as
    Struts Problem Report
    
    Struts has detected an unhandled exception:
    Messages: 	
    
        [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt
        could not load an entity: [pack.bank#7]
    
    File: 	sun/jdbc/odbc/JdbcOdbc.java
    Line number: 	6,957
    Stacktraces
    org.hibernate.exception.GenericJDBCException: could not load an entity: [pack.bank#7]
    
        org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
        org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
        org.hibernate.exception.JDBCExceptionhelper.convert(JDBCExceptionhelper.java:66)
        org.hibernate.loader.Loader.loadEntity(Loader.java:2041)
        org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
        org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
        org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3293)
        org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
        org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
        org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
        org.hibernate.event.def.DefaultLoadEventListener.onload(DefaultLoadEventListener.java:147)
        org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
        org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1026)
        org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:176)
        org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:215)
        org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
        pack.bank_$$_javassist_0.getUsername(bank_$$_javassist_0.java)
        pack.VisitorsAction.execute(VisitorsAction.java:54)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        java.lang.reflect.Method.invoke(Method.java:597)
        com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
        com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
        com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
        org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ConversionerrorInterceptor.intercept(ConversionerrorInterceptor.java:122)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
        org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        java.lang.Thread.run(Thread.java:662)
        
    
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt
    
        sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
        sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
        sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3149)
        sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:216)
        sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPreparedStatement.java:91)
        org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
        org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
        org.hibernate.loader.Loader.doQuery(Loader.java:802)
        org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
        org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
        org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
        org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
        org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3293)
        org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
        org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
        org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
        org.hibernate.event.def.DefaultLoadEventListener.onload(DefaultLoadEventListener.java:147)
        org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
        org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1026)
        org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:176)
        org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:215)
        org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
        pack.bank_$$_javassist_0.getUsername(bank_$$_javassist_0.java)
        pack.VisitorsAction.execute(VisitorsAction.java:54)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        java.lang.reflect.Method.invoke(Method.java:597)
        com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
        com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
        com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
        org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ConversionerrorInterceptor.intercept(ConversionerrorInterceptor.java:122)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
        org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        java.lang.Thread.run(Thread.java:662)
        
    
    You are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set:
    
      struts.devMode=false
    
    in your WEB-INF/classes/struts.properties file.
    
    
    




    Please Sir Anybody help to me.
  2. In Topic: struts with hibernate

    Posted 19 Jul 2012

    Hi sir,
    I try to retrieve data from database before that i stored data into the database coding is in below.In that coding i use Dao class to store the data into the database.
    package pack;
    
    import org.hibernate.SessionFactory;
    import org.hibernate.Session;
    import org.hibernate.Transaction;
    import org.hibernate.cfg.Configuration;
    
    public class FirstDoaclass implements FirstDoaInterface{
    	SessionFactory sf=new Configuration().configure().buildSessionFactory();
    	Session ses=sf.openSession();
    	Transaction t=ses.beginTransaction();
    	@Override
    	public void save(LoginAction la) {
    		// TODO Auto-generated method stub
    
    		bank r=new bank();
    		r.setName(la.getName());
    		r.setUsername(la.getUsername());
    		r.setPassword(la.getPassword());
    		r.setAddress(la.getPassword());
    		r.setEmail(la.getEmail());
    		r.setAge(la.getAge());
    		r.setBranch(la.getBranch());
    		r.setAccno(la.getAccno());
    		ses.save(r);
    		t.commit();
    		ses.close();
    		
    	}
    }
    	
    



    Now i got error to retrieve data from database.In the below coding is to retrieve data from database using that HQL process in hibernate.Unfortunately i got the the error.


    Error

    Struts Problem Report
    
    Struts has detected an unhandled exception:
    Messages: 	
    java.lang.String cannot be cast to pack.bank
    File: 	pack/VisitorsAction.java
    Line number: 	53
    Stacktraces
    java.lang.ClassCastException: java.lang.String cannot be cast to pack.bank
    
        pack.VisitorsAction.execute(VisitorsAction.java:53)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        java.lang.reflect.Method.invoke(Method.java:597)
        com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
        com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
        com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
        org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ConversionerrorInterceptor.intercept(ConversionerrorInterceptor.java:122)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
        org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        java.lang.Thread.run(Thread.java:662)
        
    
    You are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set:
    
      struts.devMode=false
    
    in your WEB-INF/classes/struts.properties file.
    
    
    










    retrieve data from database


    package pack;
    
    import org.hibernate.Query;
    import org.hibernate.SessionFactory;
    import org.hibernate.Session;
    import org.hibernate.Transaction;
    import org.hibernate.cfg.Configuration;
    
    
    import java.util.Iterator;
    
    import com.opensymphony.xwork2.ActionSupport;
    public class VisitorsAction extends ActionSupport{
    	private String username;
    	private String password;
    	SessionFactory sf=null;
    	Session ses=null;
    	Transaction t=null;
    	/**
    	 * @return the username
    	 */
    	public String getUsername() {
    		return username;
    	}
    	/**
    	 * @param username the username to set
    	 */
    	public void setUsername(String username) {
    		this.username = username;
    	}
    	/**
    	 * @return the password
    	 */
    	public String getPassword() {
    		return password;
    	}
    	/**
    	 * @param password the password to set
    	 */
    	public void setPassword(String password) {
    		this.password = password;
    	}
    	public String execute()
    	{
    		this.sf=new Configuration().configure().buildSessionFactory();
    		this.ses=sf.openSession();
    		this.t=ses.beginTransaction();
    		String view=("select username from bank");
    		Query q=ses.createQuery(view);
    
    		Iterator tt=q.iterate();
    		while(tt.hasNext())
    		{
    			bank b=(bank)tt.next();
    			String user=b.getUsername();
    			System.out.println(user);
    		}
    
    		
    		t.commit();
    		ses.close();
    		return SUCCESS;
    	}
    
    
  3. In Topic: struts with hibernate

    Posted 18 Jul 2012

    I got Another Problem that is i stored data into database but i cant able to retrieve from database
    Code is here.
    package pack;
    import org.hibernate.Query;
    import org.hibernate.SessionFactory;
    import org.hibernate.Session;
    import org.hibernate.Transaction;
    import org.hibernate.cfg.Configuration;
    import java.util.Iterator;
    
    public class FirstDoaclass implements FirstDoaInterface{
    	SessionFactory sf=null;
    	Session ses=null;
    	Transaction t=null;
    	
    	@Override
    	public void save(LoginAction la) {
    		// TODO Auto-generated method stub
    		this.sf=new Configuration().configure().buildSessionFactory();
    		this.ses=sf.openSession();
    		this.t=ses.beginTransaction();
    		bank r=new bank();
    		r.setName(la.getName());
    		r.setUsername(la.getUsername());
    		r.setPassword(la.getPassword());
    		r.setAddress(la.getPassword());
    		r.setEmail(la.getEmail());
    		r.setAge(la.getAge());
    		r.setBranch(la.getBranch());
    		r.setAccno(la.getAccno());
    		ses.save(r);
    		t.commit();
    		ses.close();
    		
    	}
    	
    
    
    
    public void view(VisitorsAction va) {
    	String user=va.getUsername();
    	String pass=va.getPassword();
    	this.sf=new Configuration().configure().buildSessionFactory();
    	this.ses=sf.openSession();
    	this.t=ses.beginTransaction();
    	String view="select username,password from bank";
    	Query q=ses.createQuery(view);
    	Iterator it=q.iterate();
    	while(it.hasNext())
    	{
    		bank b=(bank)it.next();
    		String username=b.getUsername();
    		String password=b.getPassword();
    		if((user.equals(username)) && (pass.equals(password)))
    		{
    			t.commit();
    		}
    	}
    }
    }
    
    


    I got the error as

    Struts Problem Report
    
    Struts has detected an unhandled exception:
    Messages: 	
    [Ljava.lang.Object; cannot be cast to pack.bank
    File: 	pack/FirstDoaclass.java
    Line number: 	49
    Stacktraces
    java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to pack.bank
    
        pack.FirstDoaclass.view(FirstDoaclass.java:49)
        pack.VisitorsAction.execute(VisitorsAction.java:34)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        java.lang.reflect.Method.invoke(Method.java:597)
        com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
        com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
        com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
        org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ConversionerrorInterceptor.intercept(ConversionerrorInterceptor.java:122)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
        org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        java.lang.Thread.run(Thread.java:662)
        
    
    You are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set:
    
      struts.devMode=false
    
    in your WEB-INF/classes/struts.properties file. 
    
  4. In Topic: struts with hibernate

    Posted 18 Jul 2012

    i got the output
  5. In Topic: struts with hibernate

    Posted 17 Jul 2012

    i put it into java section.Please anybody help me.And i use Tiles with only struts2 that also not came..I got

    i put it into java section.Please anybody help me.And i use Tiles with only struts2 that also not came..I got the Error as


    SEVERE: Exception starting filter struts2
    java.lang.NullPointerException
    	at com.opensymphony.xwork2.util.FileManager$FileRevision.needsReloading(FileManager.java:209)
    	at com.opensymphony.xwork2.util.FileManager.fileNeedsReloading(FileManager.java:60)
    	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.needsReload(XmlConfigurationProvider.java:325)
    	at org.apache.struts2.config.StrutsXmlConfigurationProvider.needsReload(StrutsXmlConfigurationProvider.java:168)
    	at com.opensymphony.xwork2.config.ConfigurationManager.conditionalReload(ConfigurationManager.java:220)
    	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:61)
    	at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:774)
    	at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:191)
    	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
    	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
    	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
    	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    
    



    Please try to help to solve the problem using tiles

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

mohananasundaramn90 hasn't added any friends yet.

Comments

mohananasundaramn90 has no profile comments yet. Why not say hello?