[Hibernate-JIRA] Created: (HHH-3593) be able to configure statistics enablement
by John Mazzitelli (JIRA)
be able to configure statistics enablement
------------------------------------------
Key: HHH-3593
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3593
Project: Hibernate Core
Issue Type: Improvement
Components: core
Reporter: John Mazzitelli
Priority: Minor
Right now, in order to enable Hibernate to collect and emit statistics to monitoring tools, your application has to manually execute code similar to the following:
StatisticsService mBean = new StatisticsService();
SessionFactory sessionFactory = ...get hibernate session factory...
mBean.setSessionFactory(sessionFactory);
ObjectName objectName = new ObjectName("Hibernate:application=MY_APP_NAME,type=statistics");
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbs.registerMBean(mBean, objectName);
sessionFactory.getStatistics().setStatisticsEnabled(true);
It would be nice if this was configurable, so a user of Hibernate doesn't need to write this code.
For example:
hibernate.statistics.enabled=true
hibernate.statistics.objectname=Hibernate:application=MY_APP_NAME,type=statistics
hibernate.statistics.mbeanserver=*platform*
This would turn on Hibernate statistics and tell it to register the Statistics MBean in the JVM's platform MBean Server (ManagementFactory.getPlatformMBeanServer). Of course, *platform* would only be valid on Java5 or higher VMs. Note that hibernate will need to allow the object name to be configurable as well.
Or...
hibernate.statistics.enabled=true
hibernate.statistics.objectname=Hibernate:application=MY_APP_NAME,type=statistics
hibernate.statistics.mbeanserver=my_mbs_name
This tells Hibernate to register the MBean in the named MBeanServer where the "my_mbs_name" is the default domain name of the MBeanServer you want (if it doesn't exist, Hibernate should create the MBeanServer with the named default domain).
In fact, I had the Remoting project do something similar, so you can see code that gets the MBeanServer using these two ways by looking at the .patch attached to: https://jira.jboss.org/jira/browse/JBREM-746 and its related fix.
--
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
13 years, 9 months
[Hibernate-JIRA] Created: (HHH-2710) Cannot specify on-delete="cascade" for a map or a set with just one element
by Gerald Klopp (JIRA)
Cannot specify on-delete="cascade" for a map or a set with just one element
---------------------------------------------------------------------------
Key: HHH-2710
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2710
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.4
Reporter: Gerald Klopp
Priority: Minor
I'd like to specify the on-delete="cascade" attribute for a map or for a set with just one element.
When I try to do this, I get the following exception :
Initial SessionFactory creation failed.org.hibernate.MappingException: only inverse one-to-many associations may use on-delete="cascade"
The on-delete="cascade" attribute can be specified for more complex relationships like one-to-many. But it seems that the case of a simple map or set is not covered.
- Mapping document example:
<hibernate-mapping>
<class name="Document" table="DOCUMENT">
<id name="id" column="DOCUMENT_ID">
<generator class="native" />
</id>
<map name="titles" table="DOCUMENT_TITLE" lazy="false">
<key column="DOCUMENT_ID" on-delete="cascade" />
<index column="LANGUAGE" type="string" />
<element column="TITLE" type="text" not-null="true" />
</map>
<set name="references" table="DOCUMENT_REFERENCE" lazy="false">
<key column="DOCUMENT_ID" on-delete="cascade" />
<element type="string" column="REFERENCE" />
</set>
</class>
</hibernate-mapping>
- Exception stack trace :
Initial SessionFactory creation failed.org.hibernate.MappingException: only inverse one-to-many associations may use on-delete="cascade": Document.references
Exception in thread "main" java.lang.ExceptionInInitializerError
at fr.gklopp.test.hibernate3.util.HibernateUtil.<clinit>(HibernateUtil.java:17)
at fr.gklopp.test.hibernate3.simple.DocumentManager.createAndStoreDocument(DocumentManager.java:23)
at fr.gklopp.test.hibernate3.simple.DocumentManager.main(DocumentManager.java:68)
Caused by: org.hibernate.MappingException: only inverse one-to-many associations may use on-delete="cascade": fr.gklopp.test.hibernate3.simple.Document.references
at org.hibernate.mapping.Collection.validate(Collection.java:267)
at org.hibernate.mapping.Set.validate(Set.java:19)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1106)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
at fr.gklopp.test.hibernate3.util.HibernateUtil.<clinit>(HibernateUtil.java:13)
... 2 more
- Database : Oracle 10
--
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
13 years, 9 months
[Hibernate-JIRA] Created: (HHH-2587) There is an attempt to set more parameters on a prepared statement than the latter can hold
by Zied Hamdi (JIRA)
There is an attempt to set more parameters on a prepared statement than the latter can hold
-------------------------------------------------------------------------------------------
Key: HHH-2587
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2587
Project: Hibernate3
Issue Type: Bug
Components: query-sql
Affects Versions: 3.2.3
Environment: JPA through hibernate
Reporter: Zied Hamdi
Priority: Blocker
Attachments: IntoCore.zip
You can directly import the zip content into netBeans 5.5 the just launch: the test is executed at the home page servlet call.
I have an index that doesn't exist : 11 (the total count of columns is 10) :
Hibernate: insert into BasicPersonArchiveEntry (endDate, entryPerformer_revision, entryPerformer_id, lastOccurence, note, startDate, source_revision, source_id, revision, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
could not bind value '0' to parameter: 11; Invalid argument: parameter index 11 is out of range.
SQL Error: -99999, SQLState: null
Invalid argument: parameter index 11 is out of range.
Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not insert: [com.homeservices.model.impl.BasicPersonArchiveEntry]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2267)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:52)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:516)
at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:395)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:357)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3653)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:192)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:118)
at $Proxy49.create(Unknown Source)
at tests.entities.TestArchiveServlet.processRequest(TestArchiveServlet.java:46)
at tests.entities.TestArchiveServlet.doGet(TestArchiveServlet.java:61)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
Caused by: org.apache.derby.client.am.SqlException: Invalid argument: parameter index 11 is out of range.
at org.apache.derby.client.am.PreparedStatement.checkForValidParameterIndex(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.checkSetterPreconditions(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.setLong(Unknown Source)
at org.hibernate.type.LongType.set(LongType.java:42)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:116)
at org.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:284)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2008)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2243)
... 46 more
EJB5018: An exception was thrown during an ejb invocation on [ArchivableFacadeStatelessBean]
javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.
--
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
13 years, 9 months
[Hibernate-JIRA] Created: (EJB-408) c3p0 not working with hibernate-entitymanager 3.4.0.GA
by Marcelo Romulo Fernandes (JIRA)
c3p0 not working with hibernate-entitymanager 3.4.0.GA
------------------------------------------------------
Key: EJB-408
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-408
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.4.0.GA
Environment: windows xp sp2; java sun 1.6.0_10; tomcat 6.0.18; maven 2.0.9
Reporter: Marcelo Romulo Fernandes
Priority: Minor
I was using hibernate-entitymanager 3.2.6.GA and c3p0 well, but I cannot run c3p0 with hibernate-entitymanager 3.4.0.GA. c3p0 is never called!!!
Below, follows persistence.xml, maven dependencies working with hibernate-entitymanager 3.2.6.GA, maven dependencies not woking with hibernate-entitymanager 3.4.0.GA
persistence.xml:
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="SystemDDD" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<!-- Connection properties -->
<property name="hibernate.connection.username" value="DDD"/>
<property name="hibernate.connection.password" value="DDD"/>
<property name="hibernate.default_schema" value="DDD"/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@//YYY:1521/ZZZ"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
<!-- Connection pooling properties -->
<property name="hibernate.c3p0.min_size" value="1"/>
<property name="hibernate.c3p0.max_size" value="10"/>
<property name="hibernate.c3p0.timeout" value="5000"/>
<property name="hibernate.c3p0.max_statements" value="50"/>
<property name="hibernate.c3p0.idle_test_period" value="60000"/>
<!-- Cache properties -->
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
<!-- Other properties -->
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.archive.autodetection" value="class, hbm"/>
<property name="hibernate.hbm2ddl.auto" value="none"/>
</properties>
</persistence-unit>
</persistence>
maven dependencies working with hibernate-entitymanager 3.2.6.GA
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.3.2.GA</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
maven dependencies not woking with hibernate-entitymanager 3.4.0.GA
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.4.0.GA</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>3.3.0.SP1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.2</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>3.3.0.SP1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
What is wrong or missing?
--
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
13 years, 9 months