[Hibernate-JIRA] Created: (HHH-3646) implement Criteria API querying of collection-of-component
by David Mansfield (JIRA)
implement Criteria API querying of collection-of-component
----------------------------------------------------------
Key: HHH-3646
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3646
Project: Hibernate Core
Issue Type: Patch
Components: query-criteria
Affects Versions: 3.2.6
Environment: hibernate 3.2.6, tested on linux 64-bit openjdk 1.6 (jdk1.5 for compiling). mapping created under annotations 3.3.1ga
Reporter: David Mansfield
Attachments: hib-core-query-collection-of-elements-3_2_6.patch
the attached patch implements a first cut, extremely rough, yet working extension of the CriteriaQueryTranslator class to allow for querying of properties of components inside a collection, or querying properties of associated elements of components inside a collection. eg for
* code is lightly tested, this example is for illustrative purposes only
* i use annotations, so my example is expressed in those terms, and i've only tested with mappings generated via annotations, however, the modifications only apply to the core.
@Entity
class Order {
@Id
String id;
@CollectionOfElements
Set<OrderLineItem> lineItems;
}
@Embeddable
class OrderLineItem {
@ManyToOne
Product product;
Integer quantity;
}
@Entity
class Product {
String name;
}
Then we can now do:
Criteria c = session.createCriteria(Order.class)
.createCriteria("lineItems")
.add(Restrictions.gt("quantity", new Integer(1))
.list();
or
Criteria c = session.createCriteria(Order.class)
.createCriteria("lineItems")
.createCriteria("product")
.add(Restrictions.like("name", "cake%")
.list();
--
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-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, 9 months