Hi
Please find my source code here and let me know what is the wrong ,i think
something has wrong here

Employee.java

package com.company.auth.bean;

import java.io.Serializable;

public class Employee implements Serializable {

    private static final long serialVersionUID = 1L;
    private Integer gid;
    private String lastname;
    private String firstname;
    private String privileges;

    public Employee() {


    }

    public Integer getGid() {
        return gid;
    }
    public void setGid(Integer gid) {
        this.gid = gid;
    }
    public String getLastname() {
        return lastname;
    }
    public void setLastname(String lastname) {
        this.lastname = lastname;
    }
    public String getFirstname() {
        return firstname;
    }
    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }
    public String getPrivileges() {
        return privileges;
    }
    public void setPrivileges(String privileges) {
        this.privileges = privileges;
    }

/*    public boolean isUserInRole(String role) {
        if(privileges == null) { return false; }
        else { return privileges.contains(role); }
    } */

}

-------------------------
Employee.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";>

<hibernate-mapping auto-import="true" default-lazy="false">

<class
    name="com.company.auth.bean.Employee"
    table="user"
>

    <id
        name="gid"
        type="java.lang.String"
        column="gid"
    >
        <generator class="increment" />
    </id>

    <property
        name="firstname"
        type="java.lang.String"
        column="firstname"
        not-null="true"
        length="10"
    />
    <property
        name="lastname"
        type="java.lang.String"
        column="lastname"
        not-null="true"
        length="10"
    />


    <property
        name="privileges"
        type="java.lang.String"
        column="privileges"
        not-null="false"
        length="20"
    />


</class>
</hibernate-mapping>


---------------------------------------

EmployeeDAO.java

package com.company.auth.dao;

import org.apache.cxf.service.invoker.SessionFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.orm.hibernate.HibernateTemplate;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.hibernate.*;
import org.hibernate.criterion.*;

import com.company.auth.dao.HibernateFactory;
import com.company.auth.bean.Employee;
public class EmployeeDAO extends HibernateFactory{


    public void updateUser(com.company.auth.bean.Employee obj) throws
DataAccessException{
        getHibernateTemplate().saveOrUpdate(obj);
    }

    public String updateEmployee(String firstname,String lastname,String
privileges) {

    Employee employee = new Employee();

        employee.setFirstname(firstname);
        employee.setLastname(lastname);
        employee.setPrivileges(privileges);
        System.out.println("Employe Table has been updated ------------"+
employee);
        System.out.println("FirstName------------"+
employee.getFirstname());
        System.out.println("LastName------------"+ employee.getLastname());
        System.out.println("privileges------------"+
employee.getPrivileges());
        //getHibernateTemplate().saveOrUpdate(employee);//save(employee);
        EmployeeDAO dao = new EmployeeDAO() ;
        dao.updateUser(employee);

        //return template.saveOrUpdate(employee);
        return employee.toString();
    }



}

----------------------------------------------------------------

AuthService.java

package com.company.auth.service;

import javax.jws.WebService;
import javax.jws.WebParam;
import com.company.auth.bean.Employee;

@WebService
public interface AuthService {
    String updateEmployee(@WebParam(name="firstname") String firstname,
             @WebParam(name="lastname")String lastname,
             @WebParam(name="privileges")String privileges);
}

------------------------------------------

AuthServiceImpl.java

package com.company.auth.service;

import javax.jws.WebService;

import com.company.auth.bean.Employee;
import com.company.auth.dao.EmployeeDAO;

@WebService(endpointInterface = "com.company.auth.service.AuthService",
serviceName = "corporateAuthService")
public class AuthServiceImpl implements AuthService {



    public String updateEmployee(String firstname, String lastname,
            String privileges) {
        // TODO Auto-generated method stub
        EmployeeDAO dao = new EmployeeDAO();
        com.company.auth.bean.Employee obj = new
com.company.auth.bean.Employee();
        return dao.updateEmployee(firstname, lastname,
privileges).toString();
        //return dao.updateUser(obj);

    }

}

---------------------------------------------------------

cxf.xml

<beans xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:jaxws="
http://cxf.apache.org/jaxws";
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
">

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />


  <bean id="propertyConfigurer"

class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location">
            <value>/WEB-INF/jdbc.properties</value>
        </property>
    </bean>


    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName">
            <value>${jdbc.driverClassName}</value>
        </property>
        <property name="url">
            <value>${jdbc.url}</value>
        </property>
        <property name="username">
            <value>${jdbc.username}</value>
        </property>
        <property name="password">
            <value>${jdbc.password}</value>
        </property>

    </bean>


    <!-- JNDI DataSource for J2EE environments -->

    <!-- Hibernate SessionFactory -->
    <bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource"><ref local="dataSource"/></property>
        <property name="mappingResources">
        <list>
            <value>com/company/auth/bean/Employee.hbm.xml</value>
        </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
    </bean>

<bean id="transactionManager"

class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory">
            <ref local="sessionFactory" />
        </property>
    </bean>

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

    <bean id="employeeDao" class="com.company.auth.dao.EmployeeDAO">
        <property name="hibernateTemplate">
            <ref bean="hibernateTemplate" />
        </property>
    </bean>

  <jaxws:endpoint id="corporateAuthService"
                  implementor="com.company.auth.service.AuthServiceImpl"
                  address="/swAuth"/>
</beans>



-------------------------------------------

Please help me i cant able to save data into DB table using MySQL DB

Thanks in advance,

Regards,
Bhanu





2009/1/28 Mickael Istria <[email protected]>

> Hello Bhanu,
>
> Your problem may be related to a conflict on the "asm" dependency. Indeed,
> CXF uses a newer "cglib" version than hibernate, that itself uses a newer
> "asm", so that it sometimes cause issues when integrating them together
> (Exception such as NoSuchMethodError)
> The workaround I use is to replace the old cglib (and its dependency) by
> the cglib-nodep.jar in your classpath, that is OK for Hibernate and does not
> require an old "asm".
>
> If you use Maven, this sample should help you to understand how to resolve
> such conflict:
>       <dependency>
>            <!-- This artifacts adds hibernate as a dependency -->
>           <groupId>org.ow2.bonita</groupId>
>           <artifactId>bonita-server</artifactId>
>           <version>4.0.1</version>
>           <scope>test</scope>
>           <exclusions>
>               <exclusion> <!-- Then remove the dependency to cglib to avoid
> conflicts with CXF's asm -->
>                   <groupId>cglib</groupId>
>                   <artifactId>cglib</artifactId>
>               </exclusion>
>           </exclusions>
>       </dependency>
>            <!-- Replaced old cglib by cglib-nodep -->
>       <dependency>
>           <groupId>cglib</groupId>
>           <artifactId>cglib-nodep</artifactId>
>           <version>2.1_3</version>
>       </dependency>
>
> Hope that helps...
>
> Regards,
> Mickael
>
> Bhanu B a écrit :
>
>  Hi Mert,
>> I appreciate your response, here i am getting an error while running my
>> application ,i think it desn't put data into DB table
>> some hibernate problem,
>> my requirement is
>> 1-> get data from WebService through SOAP GUI
>> 2-> updated data in to the DB Table with all integration
>> Hibernate+Spring+CXF
>>
>> i couldn't get much information about your 'mesir' application.
>> if any more information is really great help to me.
>>
>> Thanks,
>> B....
>>
>> On Tue, Jan 27, 2009 at 2:27 PM, Mert Çalışkan <[email protected]>
>> wrote:
>>
>>
>>
>>> check out mesir..
>>> I did some work with that stack.
>>>
>>> http://code.google.com/p/mesir
>>>
>>> Cheers,
>>>
>>> Mert
>>>
>>> On Tue, Jan 27, 2009 at 10:15 PM, Bhanu B <[email protected]> wrote:
>>>
>>>
>>>
>>>> Hi
>>>> Any one could tell me how to integrate Hibernate+Spring+CXF to
>>>> developing
>>>> webservices
>>>> please help me ?!!
>>>> Regards,
>>>> Bhanu
>>>>
>>>>
>>>>
>>>
>>
>>
>
>

Reply via email to