I noticed that in the Database class you can annotate the database connection parameters. Do you plan on adding one to support a data-pool mapped via a JNDI name. So I can say "jdbc/MyDatabase". This will make it viable for enterprises where the application server\container manages the connection and the passwords may be different in test vs production.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-08-15
I haven't checked other application servers but with JBoss AS7 I get the error as quoted below when connected via JNDI.
I think that perhaps it would be nice to be able to skip the part where it sets autocommit to false (perhaps via @Db annotation argument) because, well, normally we don't have autocommit set to true by default. Regardless, any operations that might break the EJB specification might consider true/false option.
Thanks
22:16:35,204 ERROR [org.apache.catalina.core.ContainerBase....] (http-0.0.0.0-8080-3) Servlet.service() for servlet Faces Servlet threw exception: java.sql.SQLException: You cannot set autocommit during a managed transaction!
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.setJdbcAutoCommit(BaseWrapperManagedConnection.java:888)
at org.jboss.jca.adapters.jdbc.WrappedConnection.setAutoCommit(WrappedConnection.java:715)
at org.ujorm.orm.metaModel.MetaDatabase.createConnection(MetaDatabase.java:769)
at org.ujorm.orm.Session.getConnection_(Session.java:669)
at org.ujorm.orm.Session.getConnection(Session.java:697)
at org.ujorm.orm.Session.getStatement(Session.java:707)
at org.ujorm.orm.Session.getRowCount(Session.java:577)
at org.ujorm.orm.Query.getCount(Query.java:134)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I noticed that in the Database class you can annotate the database connection parameters. Do you plan on adding one to support a data-pool mapped via a JNDI name. So I can say "jdbc/MyDatabase". This will make it viable for enterprises where the application server\container manages the connection and the passwords may be different in test vs production.
The JNDI is supported now by the @Db annoatation. See the Javadoc:
http://ujoframework.org/javadoc/org/ujoframework/orm/annot/Db.html
there are three ways how to manage a database connection:
* @Db(user="sa", password="xxx", jdbcUrl="jdbc:h2:mem:db1" …)
* @Db(jndi="jdbc/MyDatabase", …)
* create database connection dynamically
(see http://ujoframework.org/dokuwiki/doku.php?id=orm_faq)
I haven't checked other application servers but with JBoss AS7 I get the error as quoted below when connected via JNDI.
I think that perhaps it would be nice to be able to skip the part where it sets autocommit to false (perhaps via @Db annotation argument) because, well, normally we don't have autocommit set to true by default. Regardless, any operations that might break the EJB specification might consider true/false option.
Thanks
Hi, see the small bug fixi at revision:1291 in the SVN repository.
Send me a message please, if the solution is sufficient now.