[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-4999) createSQLQuery(query).list() result screw up when when columns in different tables have same name
by thogau (JIRA)
createSQLQuery(query).list() result screw up when when columns in different tables have same name
-------------------------------------------------------------------------------------------------
Key: HHH-4999
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4999
Project: Hibernate Core
Issue Type: Bug
Components: query-sql
Affects Versions: 3.5.0-CR-2
Environment: hibernate-core 3.5.0-CR-2
MySQL 5
Reporter: thogau
Attachments: joinProblem.zip
The same SQL query doesn't retrieve the same results with hibernate and SQL client :
{{SELECT groupe.name, center.name, roles.displayname, users.username, CASE WHEN center.id = 2 THEN 1 ELSE 0 END AS showlast
FROM groupe, center, users, roles WHERE users.role_id = roles.id AND users.center_id = center.id
AND center.group_id = groupe.id ORDER BY showlast, groupe.sitecoordinateur DESC, groupe.name, center.headcenter DESC, center.name, roles.id}}
When performed with hibernate, *group.name* is retrieved twice (*center.name* is always the same as *group.name*).
Still, it is possible to retrieve the correct value for *center.name* using *CONCAT('', center.name)*
A small eclipse + maven projet with unit test is attached.
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-5159) 'in elements' does not work on ElementCollections of Enums
by Peer Hartmann (JIRA)
'in elements' does not work on ElementCollections of Enums
----------------------------------------------------------
Key: HHH-5159
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5159
Project: Hibernate Core
Issue Type: Bug
Components: core, entity-manager, query-hql
Affects Versions: 3.5.1, 3.3.2
Environment: Oracle 10, Hibernate 3.5.1-Final
Reporter: Peer Hartmann
Attachments: bugreport-mvn.zip
When performing a query with an 'in elements' clause and an enum typed parameter, hibernate does not correctly set the parameter value for the underlying SQL. Here is an example (HQL) query:
select e from Employee e where :function in elements( e.jobFunctions );
Hibernate makes the following SQL of that (correct)
Hibernate: select employee0_.id as id9_, employee0_.name as name9_ from Employee employee0_ where ? in (select jobfunctio1_.jobfunction from employee2jobfunction jobfunctio1_ where employee0_.id=jobfunctio1_.employeeId)
...but sets the parameter wrong as it uses toString instead of the name of the enum:
[LogPreparedStatement] DEBUG - executing PreparedStatement: 'select ... from employee2jobfunction ...' with bind parameters: {1=[B@2eb6fb}
the exmaple uses an employee entity class with an ElementCollection of JobFunction-enum entries. See the attached zip-file for details.
The same query works when using an entity instead of an enum.
--
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, 10 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, 10 months