dibakar sinha

Greenhorn
+ Follow
since Oct 02, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by dibakar sinha

Did not work for me for the initial solution so i delete the tomcat and reinstall tomcat and the problem is gone!!!
5 years ago
my jsp from which i am reading which radio button is cliked is a below
<body><form action="jspcheck.do" method="post">
<%int i=0; %>
<table border="1" width="">
<tr>
<th></th><th>userId</th><th>userName</th><th>deptName</th>
</tr>
<c:forEach items="${user}" var="user">

<tr>
<td><input type=radio value="<%=i%>" name="group1"></td><td>${user.userId}</td><td>${user.userName}</td><td>${user.deptName}</td>
<%i++; %>
</tr>
</c:forEach><tr><td><input type="submit" name="delete" value="delete"></td></tr>
</table></form>
</body>
MY controller where I am sensing which radio button is clicked is as below
public ModelAndView jspcheck(HttpServletRequest request, HttpServletResponse response) throws Exception {
int i=0;
try {
for(i=0;i<10;i++) {
String value=request.getParameter("group1");
if(Integer.parseInt(value)==i) {
System.out.println(i+" radio button is selected");
int b=user.userId;
break;
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new ModelAndView("redirect","message",i);
}


I am able to know which radio button is clicked but unable to get the user id related to that radio button....I am using Hibernate ORM
Using Spring mvc(using multiactioncontroller)how to delete a specific record after displaying them in a table and selecting them as radio button,,,, i can make code understand(in controller) which radio button is clicked but not able to get the userid(primary key) for that radio button!!!please give me some sample code here!!!
I am a beginner. I want to learn webservices .Please help me with some tutorial or files , Using example will be great!!!
5 years ago
I want to learn hibernate?please give me some helpful doc or link? Also I need to know the necessacities for each of the jar that we use for setting up hibernate
Thanks!!!but i request you to provide some link from where i can start making applet code from start to last
6 years ago
I am new in Applet. Please share some resources from where i can learn applet effectively
6 years ago
please help me solving this issue,
6 years ago
Hi can anyone please tell me the cause:--------
Exception in thread "main" java.lang.ClassCastException: $Proxy1 cannot be cast to org.springframework.orm.hibernate3.HibernateTemplate
at pack1.EmployeeDao$2.doInHibernate(EmployeeDao.java:45)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:338)
at pack1.EmployeeDao.saveOrUpdate(EmployeeDao.java:49)
at pack1.SpringHibernateTest.main(SpringHibernateTest.java:28)
6 years ago
Hi anyone interested to answer my previous question?
6 years ago
Hi
Yeah i am using Eclispe IDE and right click onthe client application(Spring HibernateTest) and run as a java application.
6 years ago
Hi as per my previous mail after adding that jar still pgm not working
6 years ago
Hi Rishi I already added the below jar in the below path
commons-dbcp-1.2.2.jar


\project\spring\SpringHibernate\WebContent\WEB-INF\lib\commons-dbcp-1.2.2.jar
Is it right?
Please let me know incase there is any wrong with that?
6 years ago
I Got the following error..................Somebody please help.,,,,I am new to spring and hibernate



Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employee1Dao' defined in file [C:\Users\dell\Desktop\project\spring\SpringHibernate\src\pack1\spring-hibernate.xml]: Cannot resolve reference to bean 'hibernateTemplate' while setting bean property 'hibernateTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in file [C:\Users\dell\Desktop\project\spring\SpringHibernate\src\pack1\spring-hibernate.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in file [C:\Users\dell\Desktop\project\spring\SpringHibernate\src\pack1\spring-hibernate.xml]: Cannot resolve reference to bean 'mydatasource' while setting bean property 'datasource'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.common.dbcp.BasicDataSource] for bean with name 'mydatasource' defined in file [C:\Users\dell\Desktop\project\spring\SpringHibernate\src\pack1\spring-hibernate.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.common.dbcp.BasicDataSource
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in file [C:\Users\dell\Desktop\project\spring\SpringHibernate\src\pack1\spring-hibernate.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in file [C:\Users\dell\Desktop\project\spring\SpringHibernate\src\pack1\spring-hibernate.xml]: Cannot resolve reference to bean 'mydatasource' while setting bean property 'datasource'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.common.dbcp.BasicDataSource] for bean with name 'mydatasource' defined in file [C:\Users\dell\Desktop\project\spring\SpringHibernate\src\pack1\spring-hibernate.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.common.dbcp.BasicDataSource
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in file [C:\Users\dell\Desktop\project\spring\SpringHibernate\src\pack1\spring-hibernate.xml]: Cannot resolve reference to bean 'mydatasource' while setting bean property 'datasource'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.common.dbcp.BasicDataSource] for bean with name 'mydatasource' defined in file [C:\Users\dell\Desktop\project\spring\SpringHibernate\src\pack1\spring-hibernate.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.common.dbcp.BasicDataSource
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.common.dbcp.BasicDataSource] for bean with name 'mydatasource' defined in file [C:\Users\dell\Desktop\project\spring\SpringHibernate\src\pack1\spring-hibernate.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.common.dbcp.BasicDataSource
Caused by: java.lang.ClassNotFoundException: org.apache.common.dbcp.BasicDataSource
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:201)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:327)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1075)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:346)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at pack1.SpringHibernateTest.main(SpringHibernateTest.java:22)
My spring-hibernate.xml looks like that

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="mydatasource" class="org.apache.common.dbcp.BasicDataSource">
<property name="driverclassname" value="sun.jdbc.odbc.JdbcOdbcDriver" />
<property name="url" value="jdbc:mysql://localhost/test" />
<property name="username" value="" />
<property name="password" value="" />
</bean>
<bean id="mySessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="datasource" ref="mydatasource" />
<property name="mappingresource">
<list>
<value>/pack1/employee.hbm.xml</value>
</list>
</property>
<property name="hibernateproperties">
<value>hibernate.dialect=org.hibernate.dialect.HSQLDialect</value>
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>

<bean id="employee1Dao" class="pack1.EmployeeDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
</beans>

My client application looks like this
package pack1;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;

public class SpringHibernateTest {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Resource resource=new FileSystemResource("src/pack1/spring-hibernate.xml");
BeanFactory factory=new XmlBeanFactory(resource);
Employee employee=new Employee();
employee.setAge(23);
employee.setId("12");
employee.setName("Dibakar");
employee.setSalary(1234.78);
EmployeeDao employeeDao=(EmployeeDao)factory.getBean("employee1Dao");
employeeDao.saveOrUpdate(employee);
Employee empresult=employeeDao.getEmployee("123");

System.out.println(empresult);
}
}
My employeeDao class:----
package pack1;

import java.sql.SQLException;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.HibernateTemplate;

public class EmployeeDao {

private HibernateTemplate hibernateTemplate;

public HibernateTemplate getHibernateTemplate() {
return hibernateTemplate;
}

public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
this.hibernateTemplate = hibernateTemplate;
}


public Employee getEmployee(final String id)
{
HibernateCallback callback=new HibernateCallback() {

@Override
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
// TODO Auto-generated method stub
return session.load(Employee.class,id);
}
};
return (Employee)hibernateTemplate.execute(callback);
}
public void saveOrUpdate(final Employee employee) {

HibernateCallback callback=new HibernateCallback() {

@Override
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
// TODO Auto-generated method stub
session.saveOrUpdate(employee);
return null;
}
};
hibernateTemplate.execute(callback);
}
}

My other file are employee.java and .hbm.xml which i dont think needed for soloving this issue.somebody please help>>>>>>>>>>>>>>>>
6 years ago