[Hibernate-JIRA] Created: (HHH-3303) Parameters bound in wrong order for IN-clauses on dynamic components
by Holger Engels (JIRA)
Parameters bound in wrong order for IN-clauses on dynamic components
--------------------------------------------------------------------
Key: HHH-3303
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3303
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.6
Reporter: Holger Engels
When issuing the following query, the parameters are bound in wrong order:
List<Map> keys = Arrays.asList(CollectionUtil.map("mandator", "M", "key", "test"), CollectionUtil.map("mandator", "M", "key", "user"));
list = session.createCriteria(Profile.class).add(Restrictions.in("key", keys)).list();
// list.size() = 0, should be 2
[DEBUG] 15:24:45 [org.hibernate.SQL ]: select this_.id as id7_0_, this_.version as version7_0_, this_.key_mandator as key3_7_0_, this_.key_key as key4_7_0_, this_.created as created7_0_, this_.createdBy as createdBy7_0_, this_.modified as modified7_0_, this_.name as name7_0_ from auth_profile this_ where (this_.key_mandator, this_.key_key) in ((?, ?), (?, ?))
Hibernate: select this_.id as id7_0_, this_.version as version7_0_, this_.key_mandator as key3_7_0_, this_.key_key as key4_7_0_, this_.created as created7_0_, this_.createdBy as createdBy7_0_, this_.modified as modified7_0_, this_.name as name7_0_ from auth_profile this_ where (this_.key_mandator, this_.key_key) in ((?, ?), (?, ?))
[DEBUG] 15:24:45 [nate.jdbc.AbstractBatcher]: preparing statement
[DEBUG] 15:24:45 [hibernate.type.StringType]: binding 'M' to parameter: 1
[DEBUG] 15:24:45 [hibernate.type.StringType]: binding 'M' to parameter: 2
[DEBUG] 15:24:45 [hibernate.type.StringType]: binding 'test' to parameter: 3
[DEBUG] 15:24:45 [hibernate.type.StringType]: binding 'user' to parameter: 4
It should be:
binding 'M' to parameter: 1
binding 'test' to parameter: 2
binding 'M' to parameter: 3
binding 'user' to parameter: 4
The mapping for key is:
<dynamic-component name="key" unique="true">
<property name="mandator" column="key_mandator" type="string" length="4"/>
<property name="key" column="key_key" type="string" length="16"/>
</dynamic-component>
Interestingly, the same query works in HQL:
Query query = session.createQuery("from Profile where key in (:keys)");
query.setParameterList("keys", keys);
list = query.list();
// list.size() = 2
--
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
16 years, 9 months
[Hibernate-JIRA] Created: (HHH-2629) Enable ordering by association paths
by Jörg Heinicke (JIRA)
Enable ordering by association paths
------------------------------------
Key: HHH-2629
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2629
Project: Hibernate3
Issue Type: Patch
Components: query-criteria
Affects Versions: 3.2.4.sp1
Reporter: Jörg Heinicke
In Hibernate's criteria API ordering is not possible on association properties without explicitly creating aliases.
This also only works on one level, not recursively as it would be needed in the following example.
Criteria criteria = session.createCriteria(Account.class);
Criteria pCriteria = criteria.createCriteria("person");
pCriteria.add(Example.create(person));
pCriteria.createCriteria("company");
criteria.addOrder(Order.asc("person.company.name"));
return criteria.list();
I have changed CriteriaQueryTranslator in a way that it first searches the aliasCriteriaMap, second the associationPathCriteriaMap. And the key used for the search is no longer
StringHelper.root( propertyName );
but
StringHelper.qualifier( propertyName );
>From what I understand this can't break anything since it has always only worked with one '.' in the path. For those cases the key stays the same.
This implementation is still not perfect since
1. you need to create criteria in advance
2. you can't switch between alias and actual association path. The best would probably be to walk the path recursively.
--
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
16 years, 9 months
[Hibernate-JIRA] Created: (HBX-1038) NullPointerException trying to open "hibernate.reveng.xml" in Hibernate Reverse Engineering Editor
by Alex K (JIRA)
NullPointerException trying to open "hibernate.reveng.xml" in Hibernate Reverse Engineering Editor
--------------------------------------------------------------------------------------------------
Key: HBX-1038
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1038
Project: Hibernate Tools
Issue Type: Bug
Components: reverse-engineer
Affects Versions: 3.2.0.GA
Environment: Windows XP, Eclipse 3.3.1.1.
Reporter: Alex K
I am getting an excepting trying to open "hibernate.reveng.xml" in Hibernate Reverse Engineering Editor.
Tools are 3.2.0 GA. Eclipse is 3.3.1.1.
Stack trace:
java.lang.NullPointerException
at org.eclipse.wst.sse.ui.StructuredTextEditor.update(StructuredTextEditor.java:3096)
at org.hibernate.eclipse.mapper.editors.xpl.XMLFormEditorPart.addSourcePage(XMLFormEditorPart.java:185)
at org.hibernate.eclipse.mapper.editors.xpl.XMLFormEditorPart.addPages(XMLFormEditorPart.java:50)
at org.hibernate.eclipse.mapper.editors.ReverseEngineeringEditor.addPages(ReverseEngineeringEditor.java:84)
at org.eclipse.ui.forms.editor.FormEditor.createPages(FormEditor.java:146)
at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:283)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:661)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:426)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:592)
at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:263)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2739)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2651)
at org.eclipse.ui.internal.WorkbenchPage.access$13(WorkbenchPage.java:2643)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2595)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2590)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2574)
at org.eclipse.ui.actions.OpenWithMenu.openEditor(OpenWithMenu.java:340)
at org.eclipse.ui.actions.OpenWithMenu.access$0(OpenWithMenu.java:328)
at org.eclipse.ui.actions.OpenWithMenu$2.handleEvent(OpenWithMenu.java:190)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
hibernate.reveng.xml has been generated by the Reverse Engineering Wizard. Contents are (about 9 tables are referenced):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
<table-filter match-catalog="mysql" match-name="table1"/>
<table-filter match-catalog="mysql" match-name="table2"/>
...
</hibernate-reverse-engineering>
--
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
16 years, 9 months
[Hibernate-JIRA] Created: (HHH-3197) subquery is not valid SQL when select type is same as parent sql select type
by Nicolai Marck Ødum (JIRA)
subquery is not valid SQL when select type is same as parent sql select type
----------------------------------------------------------------------------
Key: HHH-3197
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3197
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
Environment: Java 1.5.0_14
JBoss 4.2.2.GA (Hibernate 3.2.1) - I have also tried with Hibernate 3.2.6.ga, hibernate-annotations-3.3.1.GA and hibernate-entitymanager-3.3.2.GA with same result.
PostgreSQL 8.3.0
WindowsXP
Reporter: Nicolai Marck Ødum
The following ejb3 QL:
"Delete FROM Notification noti WHERE noti NOT IN (SELECT subNoti.notifications FROM SubscriberNotification subNoti)"
Result in the following sql
"delete from Notification where id not in (select . from SubscriberNotification subscriber1_, SubscriberNotification_Notification notificati2_, Notification notificati3_ where subscriber1_.id=notificati2_.SubscriberNotification_id and notificati2_.notifications_id=notificati3_.id)"
notice the "select . from" in the subquery
if I alter the sql to be
"delete from Notification where id not in (select notificati3_.id from SubscriberNotification subscriber1_, SubscriberNotification_Notification notificati2_, Notification notificati3_ where subscriber1_.id=notificati2_.SubscriberNotification_id and notificati2_.notifications_id=notificati3_.id)"
I have not been able to create a workaround.
--
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
16 years, 9 months