amishrm sharma

Greenhorn
+ Follow
since Dec 08, 2008
Merit badge: grant badges
For More
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by amishrm sharma

Hi,

I am using struts with hibernate2. I want to do a left outer join in HQL.
Could someone tell me what I am doing wrong.
My SQL query is:

select a.CMS_ID,a.CMS_NAME,a.TIMEZONEID,b.currency_nm,a.product_cust_id ,c1.family_name,b1.sister_name
from cs_t_product_customer a,
cs_t_currency b,
cs_t_family_group c1,
cs_t_family_cms_map d1,
cs_t_sister_cms_map a1,
cs_t_sister_group b1
where
a.currency_id=b.currency_id
and d1.family_grp_id=c1.family_grp_id(+)
and a.product_cust_id=d1.product_cust_id(+)
and a1.sister_grp_id=b1.sister_grp_id(+)
and a.product_cust_id=a1.product_cust_id(+)

and my HQL query is:

select csTProductCustomer.cmsId,csTProductCustomer.cmsName,csTProductCustomer.timezoneid,csTCurrency.currencyNm,csTProductCustomer.productCustId,csTFamilyGroup.familyName,csTSisterGroup.sisterName,csTProductCustomer.noticePeriod

from CsTCurrencyErate csTCurrency,
CsTFamilyCmsMapErate csTFamilyCmsMap left outer join csTFamilyCmsMap.csTFamilyGroup csTFamilyGroup,
CsTFamilyCmsMapErate csTFamilyCmsMap1 left outer join csTFamilyCmsMap1.csTProductCustomer csTProductCustomer,

CsTSisterCmsMapErate csTSisterCmsMap left outer join csTSisterCmsMap.csTSisterGroup csTSisterGroup,
CsTSisterCmsMapErate csTSisterCmsMap1 left outer join csTSisterCmsMap1.csTProductCustomer csTProductCustomer1

where csTProductCustomer.csTCurrency.currencyId=csTCurrency.currencyId



Please Help me.

Hi everybody,

I integrate hibernate code with spring ,and when i execute my main class then i am facing below exception.

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [application-context.xml]: Invocation of init method failed; nested exception is net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:127)
at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)


below is my application-context.xml file code

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@10.151.50.178:1523:BNPLINK</value>
</property>
<property name="username">
<value>netpay</value>
</property>
<property name="password">
<value>welcome1</value>
</property>
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="mappingResources">
<list>
<value>com/jp/spring/orm/emp.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>

<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
</beans>

and below is my mapping file code

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.jp.spring.orm">
<class
name="Emp"
table="PEMP">

<id
name="id"
column="empno"
type="integer">
<generator class="assigned">
</generator>
</id>



<property
name="name"
type="string"
column="ename"
length="30"
/>

<property
name="sal"
type="double"
column="sal"
length="10"
/>

<property
name="deptno"
type="integer"
column="deptno"
length="12"
/>
</class>
</hibernate-mapping>

and pojo class code is

package com.jp.spring.orm;

public class Emp {
private int id;
private String name;
private double sal;
private int deptno;
public int getDeptno() {
return deptno;
}
public void setDeptno(int deptno) {
this.deptno = deptno;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getSal() {
return sal;
}
public void setSal(double sal) {
this.sal = sal;
}


}

and below is main class code
package com.jp.spring.orm;
import org.springframework.aop.*;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.orm.hibernate3.HibernateTemplate;

public class SpringHibernateDemo {


public static void main(String[] args) {
ApplicationContext apctx = new ClassPathXmlApplicationContext("application-context.xml");
HibernateTemplate jt = (HibernateTemplate)apctx.getBean("hibernateTemplate");

Emp e = new Emp();
e.setId(106);
e.setName("Ankur");
e.setSal(3000);
e.setDeptno(20);
jt.save(e);
System.out.println("the object is saved");
/* to read
System.out.println("here");
Emp e1=(Emp)jt.get(Emp.class,106);

System.out.println(e1.getDeptno()+e1.getName());
*/

}

}


Please help

Hi Every one,

i am new in struts 2.0. and i am using autocompleter tag of struts-dojo for autocomplete the field from database. But i am facing the below error while running my code.

java.lang.NoSuchMethodError: com.opensymphony.xwork2.ActionContext.get(Ljava/lang/String;)Ljava/lang/Object;
at com.googlecode.jsonplugin.JSONResult.execute(JSONResult.java:157)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:355)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:259)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:141)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:248)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:49)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)


below is my jsp code.

<s:url var="userList" value="/autocomplete/LookupAction.action"/>


<sx:autocompleter
indicator="indicator1"
href="%{userList}"
cssStyle="width: 200px;"
autoComplete="true"
searchType="substring"
name="firstName" label="First Name" showDownArrow="false"/>


and below is my struts.xml code

<package name="autocomplete" namespace="/autocomplete" extends="json-default">
<default-interceptor-ref name="completeStack" />
<action name="LookupAction" class="example.LookupAction">
<result type="json" />
</action>
</package>

and my action code.

package example;
import java.util.List;
import com.myapp.dao.LookupDaoImpl;
import com.myapp.dto.User;
import com.opensymphony.xwork2.ActionSupport;
import java.util.HashMap;
import java.util.Map;

public class LookupAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 7025220437464516839L;
private Map<String, String> map;

public String execute() throws Exception {
map = new HashMap<String, String>();

LookupDaoImpl objLookupDaoImpl = new LookupDaoImpl();
List<User> users = objLookupDaoImpl.doLookup();

for (User user : users) {
map.put(user.getUserCode(), user.getUserFirstName() + " "
+ user.getUserLastName());
}

return SUCCESS;
}
public Map<String, String> getMap() {
return map;
}

public void setMap(Map<String, String> map) {
this.map = map;
}
}


i would appreciate you guys, could you please help me find out the problem.

Regards,
Amit Sharma
15 years ago
Hi everyone,

I am try to run a web service from eclipse using a top down Web Service via Axis.Everything is fine but in the end it gives this error

IWAB0489E Error when deploying Web service to Axis runtime
axis-admin failed with {http://schemas.xmlsoap.org/soap/envelope/}Client The service cannot be found for the endpoint reference (EPR) http://localhost:7001/Axis2WSTest/services/AdminService


If someone can give some hint, it will be a great help.

-------------------------
Regards,
Amit Sharma
15 years ago
Thanks Paul..
it's working now.
Hi everyone! I'm developing my first java application using hibernate. I'm stuck with this problem and I can't figure out where's my mistake, so if someone has any idea it would be very helpful.

Basically,my code is properly excuted, but each and every excution time previous data from the table is deleted from the database and new data is inserted into the db. Please suggest me.

i am using Oracle 10g database server.

Please check the below code.
---------------------------------------------------------------------------
in HibernateUtil class
---------------------------------------------------------------------------

---------------------------------------------------------------------------
in DataManger class
---------------------------------------------------------------------------

---------------------------------------------------------------------------
in Mapping file
---------------------------------------------------------------------------


---------------------------------------------------------------------------
in Configuration File Hibernate.cfg.xml
---------------------------------------------------------------------------


--------------------------------------
Best Regards,
Amit Sharma
[ December 17, 2008: Message edited by: Paul Sturrock ]
Can we send 'excel sheet' as a SOAP attachment? if it is possible then please send me code for the same.
15 years ago