BTW, I have hit the bug ARIES-796 which is a kind of show stopper for us in
proceeding further.

https://issues.apache.org/jira/browse/ARIES-796.

I guess it is fixed in version 0.4. However, the karaf enterprise feature as
part of karaf-2.2.8 bundles only 0.3.2. Any idea how I can work around this
bug?

My requirement is something like this.

I have a bean which executes a named jpql or native sql. The query names
along with other parameters like whether it is a jpql or a native sql and
the result type (single or list) is passed on to this bean from a camel
route via the exchange in headers and the bean is invoked via bean binding.

Inside the camel route, I set the exchange headers by retrieving the values
from a configuration file.

The contents of the blueprint xml is as follows:

<cm:property-placeholder
persistent-id="businessservices.accountsummary"></cm:property-placeholder>

    <bean id="dbSelectService" class="jpa.utils.DBSelectService">
        <tx:transaction method="*" />
        <jpa:context property="entityManager" unitname="test"/>
    </bean>

I invoke the bean as follows:

from("direct:getaccountsummary").routeId("accountsummary").autoStartup(true)
.process(new AccountSummaryPreProcessor())
.to("bean:dbSelectService?method=processRequest")

The AccountSummaryPreProcessor is where I retrieve the values (named query
name,whether native or not and whether the result is a list or a single
result) as follows:

exchange.in.headers.put("NAMED.QUERY.NAME", 
                
exchange.context.resolvePropertyPlaceholders("{{accountsummary.namedquery.name}}"))
                exchange.in.headers.put("NAMED.QUERY.ISNATIVE", 
                
exchange.context.resolvePropertyPlaceholders("{{accountsummary.namedquery.isnative}}"))
                exchange.in.headers.put("NAMED.QUERY.RESULT.TYPE", 
                
exchange.context.resolvePropertyPlaceholders("{{accountsummary.namedquery.result.type}}"))



I guess the problem is when I try to use the cm:property-placeholder in
conjunction with the jpa:context is when I hit the bug.

Is there a way where I can retrieve the entityManager from jndi and use a
reference instead of jpa:context to work around this bug?

I know how to inject a entitymanagerfactory as follows:

<reference id="entityManagerFactory"
interface="javax.persistence.EntityManagerFactory"
filter="(osgi.unit.name=test)" />

However, I am using a JTA Transaction manager.

Not too sure if I can make a call to the
entityManagerFactory.createEntityManager() in this case.

best regards
Sriraman.

--
View this message in context: 
http://karaf.922171.n3.nabble.com/Unable-to-install-jndi-feature-in-Karaf-3-0-0-SNAPSHOT-tp4025193p4025197.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to