You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Kalyan <ka...@gmail.com> on 2019/06/28 21:18:19 UTC

HikariCp to set JtaManaged

Hello,
Does Hikari supports JTA ?

In the openejb how can i set to JtaManaged = true for the HikariCP? 

p.put("DS1",
"new://Resource?type=javax.sql.DataSource&class-name=org.superbiz.ConnectionPoolFactory&factory-name=create");
        p.put("DS1.JdbcDriver", "oracle.jdbc.OracleDriver");
        p.put("DS1.JdbcUrl", "jdbc:oracle:thin:@xxxxxx1521/rwdb");
        p.put("DS1.UserName", "admin");
        p.put("DS1.Password", "xxxxxx");
        p.put("DS1.LogSql", "true");
        p.put("DS1.JtaManaged", "true");

Even though i set to true. Looks like its ignored. 

WARN - unused property 'JtaManaged' for resource 'DS1'



public class ConnectionPoolFactory {
    private Properties properties;
    public Properties getProperties() {
        return properties;
    }
    public void setProperties(final Properties properties) {
        this.properties = properties;
    }

    public Object create() {
            HikariConfig hikariConfig = new HikariConfig();
            int connIdleTimeInMinutes = 10;
            int connWaitTimeInMilliSec = 1000;
            // Initialize connection pool
           
hikariConfig.setPoolName(properties.getProperty("HikariDS.PoolName"));
            hikariConfig.setJdbcUrl(properties.getProperty("JdbcUrl"));
            hikariConfig.setAutoCommit(false);
            hikariConfig.setUsername(properties.getProperty("Username"));
            hikariConfig.setPassword(properties.getProperty("Password"));
           
hikariConfig.setMaximumPoolSize(Integer.parseInt(properties.getProperty("MaximumPoolSize",
"20")));
           
hikariConfig.setMinimumIdle(Integer.parseInt(properties.getProperty("MinimumIdle",
"20")));
            hikariConfig.setIdleTimeout(connIdleTimeInMinutes * 60 * 1000);
            hikariConfig.setConnectionTimeout(connWaitTimeInMilliSec);
            HikariDataSource resource = new HikariDataSource(hikariConfig);
            return resource;
    }
}


Due to this the transactions are not performing. As it suppose to. 
Please help me with this. 

thanks
Kalyan



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Re: HikariCp to set JtaManaged

Posted by Jean-Louis Monteiro <jl...@tomitribe.com>.
Our DataSourceFactory does not have support for this kind of DataSource

In addition to Tomcat, DBCP1, and DBCP2, we have BoneCP.
The amount of work is not huge, but it's not supported out of the box
--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com


On Sat, Jun 29, 2019 at 10:30 PM Jonathan Gallimore <
jonathan.gallimore@gmail.com> wrote:

> We'll need to wire it into a ManagedConnection. Not sure how to do that off
> the top of my head, but I'm working in that area on Monday, so I'll help
> you out.
>
> Jon
>
> On Fri, 28 Jun 2019, 22:18 Kalyan, <ka...@gmail.com> wrote:
>
> > Hello,
> > Does Hikari supports JTA ?
> >
> > In the openejb how can i set to JtaManaged = true for the HikariCP?
> >
> > p.put("DS1",
> >
> >
> "new://Resource?type=javax.sql.DataSource&class-name=org.superbiz.ConnectionPoolFactory&factory-name=create");
> >         p.put("DS1.JdbcDriver", "oracle.jdbc.OracleDriver");
> >         p.put("DS1.JdbcUrl", "jdbc:oracle:thin:@xxxxxx1521/rwdb");
> >         p.put("DS1.UserName", "admin");
> >         p.put("DS1.Password", "xxxxxx");
> >         p.put("DS1.LogSql", "true");
> >         p.put("DS1.JtaManaged", "true");
> >
> > Even though i set to true. Looks like its ignored.
> >
> > WARN - unused property 'JtaManaged' for resource 'DS1'
> >
> >
> >
> > public class ConnectionPoolFactory {
> >     private Properties properties;
> >     public Properties getProperties() {
> >         return properties;
> >     }
> >     public void setProperties(final Properties properties) {
> >         this.properties = properties;
> >     }
> >
> >     public Object create() {
> >             HikariConfig hikariConfig = new HikariConfig();
> >             int connIdleTimeInMinutes = 10;
> >             int connWaitTimeInMilliSec = 1000;
> >             // Initialize connection pool
> >
> > hikariConfig.setPoolName(properties.getProperty("HikariDS.PoolName"));
> >             hikariConfig.setJdbcUrl(properties.getProperty("JdbcUrl"));
> >             hikariConfig.setAutoCommit(false);
> >             hikariConfig.setUsername(properties.getProperty("Username"));
> >             hikariConfig.setPassword(properties.getProperty("Password"));
> >
> >
> >
> hikariConfig.setMaximumPoolSize(Integer.parseInt(properties.getProperty("MaximumPoolSize",
> > "20")));
> >
> >
> >
> hikariConfig.setMinimumIdle(Integer.parseInt(properties.getProperty("MinimumIdle",
> > "20")));
> >             hikariConfig.setIdleTimeout(connIdleTimeInMinutes * 60 *
> 1000);
> >             hikariConfig.setConnectionTimeout(connWaitTimeInMilliSec);
> >             HikariDataSource resource = new
> HikariDataSource(hikariConfig);
> >             return resource;
> >     }
> > }
> >
> >
> > Due to this the transactions are not performing. As it suppose to.
> > Please help me with this.
> >
> > thanks
> > Kalyan
> >
> >
> >
> > --
> > Sent from:
> > http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
> >
>

Re: HikariCp to set JtaManaged

Posted by Jonathan Gallimore <jo...@gmail.com>.
We'll need to wire it into a ManagedConnection. Not sure how to do that off
the top of my head, but I'm working in that area on Monday, so I'll help
you out.

Jon

On Fri, 28 Jun 2019, 22:18 Kalyan, <ka...@gmail.com> wrote:

> Hello,
> Does Hikari supports JTA ?
>
> In the openejb how can i set to JtaManaged = true for the HikariCP?
>
> p.put("DS1",
>
> "new://Resource?type=javax.sql.DataSource&class-name=org.superbiz.ConnectionPoolFactory&factory-name=create");
>         p.put("DS1.JdbcDriver", "oracle.jdbc.OracleDriver");
>         p.put("DS1.JdbcUrl", "jdbc:oracle:thin:@xxxxxx1521/rwdb");
>         p.put("DS1.UserName", "admin");
>         p.put("DS1.Password", "xxxxxx");
>         p.put("DS1.LogSql", "true");
>         p.put("DS1.JtaManaged", "true");
>
> Even though i set to true. Looks like its ignored.
>
> WARN - unused property 'JtaManaged' for resource 'DS1'
>
>
>
> public class ConnectionPoolFactory {
>     private Properties properties;
>     public Properties getProperties() {
>         return properties;
>     }
>     public void setProperties(final Properties properties) {
>         this.properties = properties;
>     }
>
>     public Object create() {
>             HikariConfig hikariConfig = new HikariConfig();
>             int connIdleTimeInMinutes = 10;
>             int connWaitTimeInMilliSec = 1000;
>             // Initialize connection pool
>
> hikariConfig.setPoolName(properties.getProperty("HikariDS.PoolName"));
>             hikariConfig.setJdbcUrl(properties.getProperty("JdbcUrl"));
>             hikariConfig.setAutoCommit(false);
>             hikariConfig.setUsername(properties.getProperty("Username"));
>             hikariConfig.setPassword(properties.getProperty("Password"));
>
>
> hikariConfig.setMaximumPoolSize(Integer.parseInt(properties.getProperty("MaximumPoolSize",
> "20")));
>
>
> hikariConfig.setMinimumIdle(Integer.parseInt(properties.getProperty("MinimumIdle",
> "20")));
>             hikariConfig.setIdleTimeout(connIdleTimeInMinutes * 60 * 1000);
>             hikariConfig.setConnectionTimeout(connWaitTimeInMilliSec);
>             HikariDataSource resource = new HikariDataSource(hikariConfig);
>             return resource;
>     }
> }
>
>
> Due to this the transactions are not performing. As it suppose to.
> Please help me with this.
>
> thanks
> Kalyan
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
>