[Hibernate-JIRA] Created: (HHH-1979) Unable to locate current JTA transaction
by Kuldeep Singh Virdi (JIRA)
Unable to locate current JTA transaction
----------------------------------------
Key: HHH-1979
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1979
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1
Environment: Hibernat 3.1, My-SQL 5.0, JBOss
Reporter: Kuldeep Singh Virdi
Hi,
I have made a hibernate-service.xml file and deployed it under myApplication.har file
The xml file contents are
<?xml version="1.0"?>
<server>
<mbean code="org.hibernate.jmx.HibernateService"
name="jboss.jca:service=HibernateFactory,name=HibernateFactory">
<!-- Required services -->
<depends>jboss.jca:service=RARDeployer</depends>
<!-- Bind the Hibernate service to JNDI -->
<attribute name="JndiName">java:/hibernate/SessionFactory</attribute>
<!-- Datasource settings -->
<attribute name="Datasource">java:/jdbc/mysqlserverr</attribute>
<attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
<!-- Transaction integration -->
<attribute name="TransactionStrategy">
org.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">
org.hibernate.transaction.JBossTransactionManagerLookup</attribute>
<attribute name="FlushBeforeCompletionEnabled">true</attribute>
<attribute name="AutoCloseSessionEnabled">true</attribute>
<!-- Fetching options -->
<attribute name="MaximumFetchDepth">5</attribute>
<!-- Second-level caching -->
<attribute name="SecondLevelCacheEnabled">true</attribute>
<attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute>
<attribute name="QueryCacheEnabled">true</attribute>
<!-- Logging -->
<attribute name="ShowSqlEnabled">true</attribute>
</mbean>
</server>
Through my Stateless Session EJB i call a method
private Session getSession() {
if (sessionFactory == null)
sessionFactory = // by look up
}
return sessionFactory.getCurrentSession();
}
I get following excpetion
09:29:14,304 INFO [STDOUT] org.hibernate.HibernateException: Unable to locate current JTA transaction
at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:604)
at com.daffodilwoods.framework.datasource.ResourceManager.currentSession(ResourceManager.java:234)
at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getHibernateSession(DataObjectMetaD
at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getDefaultColumns(DataObjectMetaDat
at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getObject(DataObjectMetaDataLoader.
at com.daffodilwoods.framework.core.view.server.metadataloader.AbsTableMetaDataUtil.loadMetadata(AbsTableMetaDataU
at com.daffodilwoods.framework.table.server.TableMetaDataLoader.getObject(TableMetaDataLoader.java:87)
at com.daffodilwoods.framework.table.server.TableService.createView(TableService.java:32)
at com.daffodilwoods.framework.core.view.server.service.AbsViewService.init(AbsViewService.java:41)
at com.daffodilwoods.framework.core.view.server.service.AbsViewService.getViewMetaDataHandler(AbsViewService.java:
at com.daffodilwoods.framework.table.server.TableService.getData(TableService.java:56)
at com.daffodilwoods.framework.core.view.server.service.AbsViewService.getData(AbsViewService.java:68)
at com.daffodilwoods.framework.core.view.server.service.ViewService.getData(ViewService.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:299)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:186)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
09:29:14,304 INFO [STDOUT] org.hibernate.HibernateException: Unable to locate current JTA transaction
Can u tell me wht can i do for it.
I think there is not support for providing currentSessionContext attribute in this xml file also
Please reply
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
18 years, 11 months
[Hibernate-JIRA] Created: (HHH-2043) There is an bug in InformixDialect preventing generator-class=native to work.
by Andrew from Poland (JIRA)
There is an bug in InformixDialect preventing generator-class=native to work.
-----------------------------------------------------------------------------
Key: HHH-2043
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2043
Project: Hibernate3
Type: Bug
Components: query-sql
Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3, 3.2.0.cr4
Environment: hibernate version 3.1.3, IBM Informix Dynamic Server Version 10.00.FC3R1, JDBC IBM Informix driver ver 3.0.JC3 (ifxjdbc-3.0-jc3.jar)
Reporter: Andrew from Poland
Priority: Minor
When there is an column of SERIAL or SERIAL8 type (identity types in Informix) database expect this column to appear in INSERT clause with value equal 0, for example:
INSERT into my_table (my_serial_column, other_column) values (0, "some value"); - in this example my_serial_column is an identity column.
Using current InformixDialect this insert looks like this:
INSERT into my_table (other_column) values ( "some value");
which causes an exception:
java.sql.SQLException: Error In Specifying Automatically (Server) Generated Keys.
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373)
at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3208)
at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3518)
at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2353)
at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2269)
at com.informix.jdbc.IfxSqli.executePrepare(IfxSqli.java:1153)
at com.informix.jdbc.IfxPreparedStatement.e(IfxPreparedStatement.java:318)
at com.informix.jdbc.IfxPreparedStatement.a(IfxPreparedStatement.java:298)
at com.informix.jdbc.IfxPreparedStatement.<init>(IfxPreparedStatement.java:275)
at com.informix.jdbc.IfxSqliConnect.prepareStatement(IfxSqliConnect.java:2077)
at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:418)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:385)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:40)
at $Proxy10.prepareStatement(Unknown Source)
...
I've tested a solution - dialect must redefine getIdentityInsertString method like this:
public String getIdentityInsertString() {
return "0";
}
After that identity column appear in INSERT clause with value set to 0.
I'am using hibernate version 3.1.3, but in the latest build 3.2.0.cr4 problem still exist (i've downloaded it and checked InformixDialect.java file).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
19 years
[Hibernate-JIRA] Created: (HHH-2231) Using "create table" strictly from org.hibernate.dialect.Dialect
by Mark Gorokhov (JIRA)
Using "create table" strictly from org.hibernate.dialect.Dialect
----------------------------------------------------------------
Key: HHH-2231
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2231
Project: Hibernate3
Type: Improvement
Components: core
Versions: 3.2.0.ga
Environment: Hibernate v 3.2.0, October 16, 2006,
HSQLDB 1.8.0.7 (Using In-process mode)
Reporter: Mark Gorokhov
Priority: Trivial
Configuration property setProperty(Environment.HBM2DDL_AUTO, "update") automatically create missing HSQLDB In-process database. HSQL default "create table" is converted to "create memory table". Hibernate does not provide an option to convert "create table" into "create cached table".
A keyword "create table" could be found in Hibernate core in many places, including org.hibernate.mapping.Table without an option to override "create table" behavior.
Proposed: add method Dialect.getCreateTableString() similar to to Dialect.getCreateTemporaryTableString() and use it everywere in the code where "create table" is required.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
19 years
[Hibernate-JIRA] Created: (HBX-830) Database errors should not be displayed in Log Error view
by Dariusz Tylus (JIRA)
Database errors should not be displayed in Log Error view
---------------------------------------------------------
Key: HBX-830
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-830
Project: Hibernate Tools
Type: Improvement
Components: eclipse
Versions: 3.2beta8
Environment: Eclipse 3.2, Hibernate Tool 3.2 beta 8
Reporter: Dariusz Tylus
When user select Refresh in eg reveng editor and there is an error during reading database schema user is not notyiied about an error and see the incompleat database schema in the three.
Such situation is common when you are using Oracle database and there is problem with BIN tables.
Evry errors are logged to the PDE Runtime -> Log Error View. This view is for eclipse developers not for applications programers.
Database problems are application specific so they should not be diplayed in Log Error view.
My sugestion is:
1. Notify the user about dtdabase error when the database schema is read.
2. Mark the database tree in reveng editor as incompleate.
3. Stop logging database errors to the Log Error view
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
19 years
[Hibernate-JIRA] Created: (ANN-494) Determine Referenced Entity For Embeddable types from the parameterised type
by Edward Costello (JIRA)
Determine Referenced Entity For Embeddable types from the parameterised type
----------------------------------------------------------------------------
Key: ANN-494
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-494
Project: Hibernate Annotations
Type: Improvement
Components: binder
Versions: 3.2.0.cr1
Reporter: Edward Costello
When a collection is mapped using @ManyToOne or @CollectionOfElements, the entity in the collection is derived from the parametrised type of the collection. e.g. there is no need to explicitly indicate the elements of the following collection are books.
@ManyToOne
Set<Book> books;
It would be nice if the same kind of discovery could be applied to Embeddable types when contained in a CollectionOfElements. E.g. it would be nice if Hibernate could derive that the embedded Versioned references a Book in the example below
@CollectionOfElements
Set<Versioned<Book>>;
@Embeddable
class Versioned<T> {
T rightSide;
Date date;
}
Even if it wasn't derived, it would be good to be able to specify it. Currently the only way to make the above work is to create a subclass of Versioned that explicitly binds the type parameter to Book. Without this the below exception is thrown while building the session factory
Exception in thread "main" java.lang.IllegalStateException: Property rightSide has an unbound type and no explicit target entity.
at org.hibernate.cfg.AnnotationBinder.addElementsOfAClass(AnnotationBinder.java:946)
at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:1655)
at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1054)
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:543)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:484)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
at org.hibernate.cfg.annotations.CollectionBinder.bind(CollectionBinder.java:377)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1476)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:706)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:452)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:268)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1210)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
19 years
[Hibernate-JIRA] Created: (HHH-2207) Suggested fix for HQL - MySQL setMaxResults issue
by Toby Moore (JIRA)
Suggested fix for HQL - MySQL setMaxResults issue
-------------------------------------------------
Key: HHH-2207
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2207
Project: Hibernate3
Type: Bug
Components: query-hql
Versions: 3.2.0.ga
Environment: Hi 3.2.0.ga MySQL
Reporter: Toby Moore
Hi,
After some experimentation, we'd like to suggest an easy fix to a problem we encountered.
When using HQL with the Hibernate 3 entity manager to limit the number of records returned ( at the database level, via generated SQL, not in memory) we were getting an exception due to the query builder trying to attach a parameter to the prepared statement that was out of bounds :
by: java.sql.SQLException: Parameter index out of range (4 > number of parameters, which is 3).
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:2556)
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:2584)
at com.mysql.jdbc.PreparedStatement.setInt(PreparedStatement.java:2540)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setInt(NewProxyPreparedStatement.java:677)
at org.hibernate.loader.Loader.bindLimitParameters(Loader.java:1616)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1560)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2156)
... 10 more
On looking at the code in the method bindParameterValues in org.hibernate.loader.hql.QueryLoader ( line 491 ) the method returns the next parameter position that needs to be set, not the amount of parameters it has added, which is expected in Loader.java on the line
col += bindParameterValues( st, queryParameters, col, session );
This causes the parameter count to get out of sync and thus throw the expcetion saying that it can't add a parameter out of range.
A simple fix for this is to change the return line in QueryLoader to be
return position - startPosition;
which will return the amount of parameters this method added.
We've tested this on our mysql implementation and it works, and run the unit tests to check that no extra errors are generated. If this seems like a good fix then i'll submit it as a patch via the JIRA, but would like to hear any thoughts first?
Kind regards,
TobyM - MindCandyDesign London
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
19 years