You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "sarada.ch" <sa...@gmail.com> on 2017/05/26 02:11:56 UTC

Camel-hibernate issue Unable to convert value org.springframework.orm.hibernate4.LocalSessionFactoryBean@59a6b72c to type org.hibernate.SessionFactory

Hi All

I am trying camel_hibernate  and ran into compatibility issue. Camel version
2.17 and JBoss Fuse 6.3 I am using Blueprint DSL

/Error message :/ 
*Unable to convert value
org.springframework.orm.hibernate4.LocalSessionFactoryBean@59a6b72c to type
org.hibernate.SessionFactory*

/Camel.xml/

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd                                
http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd     
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
    
    <bean class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close" id="dataSource">
        <property name="url"
value="jdbc:sqlserver://localhost:1433;DatabaseName=Maxtest"/>
        <property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
        <property name="username" value="root"/>
        <property name="password" value="root"/>
        <property name="removeAbandoned" value="true"/>
        <property name="initialSize" value="20"/>
        <property name="maxActive" value="30"/>
    </bean>
    
    <bean
       
class=&quot;&lt;b>org.apacheextras.camel.component.hibernate.HibernateComponen*t"
id="hibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
        
    </bean>
    <bean
       
class=&quot;&lt;b>org.springframework.orm.hibernate4.LocalSessionFactoryBean*"
id="sessionFactory">
        <property name="dataSource" ref="dataSource"/>
        <property name="annotatedClasses">
            <list>
                <value>com.x.dto.ReferenceTable</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <value>
				hibernate.dialect=org.hibernate.dialect.SQLServerDialect
			</value>
        </property>
    </bean>
    <bean
        class="org.springframework.transaction.support.TransactionTemplate"
id="transactionTemplate">
        <property name="transactionManager" ref="transactionManager"/>
    </bean>
    
    
    <bean
       
class="org.springframework.orm.hibernate4.HibernateTransactionManager"
id="transactionManager">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
    <camelContext id="_context1"
xmlns="http://camel.apache.org/schema/blueprint">
        <route id="_route1">
            <from id="form" uri="timer://foo?repeatCount=1"/>
            <to id="to"
uri="hibernate:com.x.dto.ReferenceTable?consumer.query=from
com.example.ReferenceTable order by key"/>
            <log id="log" message="${body}"/>
        </route>
    </camelContext>
</blueprint>

Any help is accpreciated




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-hibernate-issue-Unable-to-convert-value-org-springframework-orm-hibernate4-LocalSessionFactoryy-tp5800751.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel-hibernate issue Unable to convert value org.springframework.orm.hibernate4.LocalSessionFactoryBean@59a6b72c to type org.hibernate.SessionFactory

Posted by Andrea Cosentino <an...@yahoo.com.INVALID>.
If you are using Fuse you've to ask to Red Hat support.

 
--
Andrea Cosentino 
----------------------------------
Apache Camel PMC Member
Apache Karaf Committer
Apache Servicemix PMC Member
Email: ancosen1985@yahoo.com
Twitter: @oscerd2
Github: oscerd


On Friday, May 26, 2017 8:23 AM, sarada.ch <sa...@gmail.com> wrote:



Hi All


I am trying camel_hibernate  and ran into compatibility issue. Camel version

2.17 and JBoss Fuse 6.3 I am using Blueprint DSL


/Error message :/ 

*Unable to convert value

org.springframework.orm.hibernate4.LocalSessionFactoryBean@59a6b72c to type

org.hibernate.SessionFactory*


/Camel.xml/


<?xml version="1.0" encoding="UTF-8"?>

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0

https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd                               

http://camel.apache.org/schema/blueprint

http://camel.apache.org/schema/blueprint/camel-blueprint.xsd     

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd">

    

    <bean class="org.apache.commons.dbcp.BasicDataSource"

        destroy-method="close" id="dataSource">

        <property name="url"

value="jdbc:sqlserver://localhost:1433;DatabaseName=Maxtest"/>

        <property name="driverClassName"

value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>

        <property name="username" value="root"/>

        <property name="password" value="root"/>

        <property name="removeAbandoned" value="true"/>

        <property name="initialSize" value="20"/>

        <property name="maxActive" value="30"/>

    </bean>

    

    <bean

      

class=&quot;&lt;b>org.apacheextras.camel.component.hibernate.HibernateComponen*t"

id="hibernate">

        <property name="sessionFactory" ref="sessionFactory"/>

        

    </bean>

    <bean

      

class=&quot;&lt;b>org.springframework.orm.hibernate4.LocalSessionFactoryBean*"

id="sessionFactory">

        <property name="dataSource" ref="dataSource"/>

        <property name="annotatedClasses">

            <list>

                <value>com.x.dto.ReferenceTable</value>

            </list>

        </property>

        <property name="hibernateProperties">

            <value>

                hibernate.dialect=org.hibernate.dialect.SQLServerDialect

            </value>

        </property>

    </bean>

    <bean

        class="org.springframework.transaction.support.TransactionTemplate"

id="transactionTemplate">

        <property name="transactionManager" ref="transactionManager"/>

    </bean>

    

    

    <bean

      

class="org.springframework.orm.hibernate4.HibernateTransactionManager"

id="transactionManager">

        <property name="sessionFactory" ref="sessionFactory"/>

    </bean>

    <camelContext id="_context1"

xmlns="http://camel.apache.org/schema/blueprint">

        <route id="_route1">

            <from id="form" uri="timer://foo?repeatCount=1"/>

            <to id="to"

uri="hibernate:com.x.dto.ReferenceTable?consumer.query=from

com.example.ReferenceTable order by key"/>

            <log id="log" message="${body}"/>

        </route>

    </camelContext>

</blueprint>


Any help is accpreciated





--

View this message in context: http://camel.465427.n5.nabble.com/Camel-hibernate-issue-Unable-to-convert-value-org-springframework-orm-hibernate4-LocalSessionFactoryy-tp5800751.html

Sent from the Camel - Users mailing list archive at Nabble.com.