[Hibernate-JIRA] Created: (HHH-3627) String Scalar Function CONCAT and operator || in HQL not working correctly with numeric values
by Eric Belanger (JIRA)
String Scalar Function CONCAT and operator || in HQL not working correctly with numeric values
----------------------------------------------------------------------------------------------
Key: HHH-3627
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3627
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.3.1
Environment: MS SQL 2005
Reporter: Eric Belanger
Priority: Minor
Since HQL translate the CONCAT and || to + in SQL, numeric values get added together instead of being converted to String and concanated. Also causes problems when concatenating a numeric with a string.
SELECT CONCAT(1, 2) FROM...
Returns 3 instead of '12'
SELECT CONCAT('TWO', 2) FROM ...
java.sql.SQLException: Conversion failed when converting the varchar value 'TWO' to data type int.
java.sql.SQLException: Conversion failed when converting the varchar value 'TWO' to data type int.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)
at net.sourceforge.jtds.jdbc.TdsCore.isDataInResultSet(TdsCore.java:792)
at net.sourceforge.jtds.jdbc.JtdsResultSet.<init>(JtdsResultSet.java:146)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:424)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:693)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.console.HQLQueryPage.getList(HQLQueryPage.java:50)
at org.hibernate.eclipse.console.views.QueryPageViewer$ContentProviderImpl.getElements(QueryPageViewer.java:114)
at org.eclipse.jface.viewers.StructuredViewer.getRawChildren(StructuredViewer.java:937)
at org.eclipse.jface.viewers.ColumnViewer.getRawChildren(ColumnViewer.java:693)
at org.eclipse.jface.viewers.AbstractTableViewer.getRawChildren(AbstractTableViewer.java:1071)
at org.eclipse.jface.viewers.StructuredViewer.getFilteredChildren(StructuredViewer.java:871)
at org.eclipse.jface.viewers.StructuredViewer.getSortedChildren(StructuredViewer.java:994)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefreshAll(AbstractTableViewer.java:685)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:633)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:620)
at org.eclipse.jface.viewers.AbstractTableViewer$2.run(AbstractTableViewer.java:576)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1368)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1330)
at org.eclipse.jface.viewers.AbstractTableViewer.inputChanged(AbstractTableViewer.java:574)
at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:251)
at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1606)
at org.hibernate.eclipse.console.views.QueryPageViewer.createTable(QueryPageViewer.java:218)
at org.hibernate.eclipse.console.views.QueryPageViewer.createControl(QueryPageViewer.java:197)
at org.hibernate.eclipse.console.views.QueryPageViewer.<init>(QueryPageViewer.java:154)
at org.hibernate.eclipse.console.views.QueryPageTabView.rebuild(QueryPageTabView.java:114)
at org.hibernate.eclipse.console.views.QueryPageTabView$1.contentsChanged(QueryPageTabView.java:78)
at org.hibernate.eclipse.console.views.QueryPageTabView$1.intervalAdded(QueryPageTabView.java:88)
at javax.swing.AbstractListModel.fireIntervalAdded(AbstractListModel.java:130)
at org.hibernate.console.QueryPageModel.add(QueryPageModel.java:67)
at org.hibernate.console.KnownConfigurations$1.queryPageCreated(KnownConfigurations.java:90)
at org.hibernate.console.ConsoleConfiguration.fireQueryPageCreated(ConsoleConfiguration.java:419)
at org.hibernate.console.ConsoleConfiguration.access$5(ConsoleConfiguration.java:415)
at org.hibernate.console.ConsoleConfiguration$4.execute(ConsoleConfiguration.java:391)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:383)
at org.hibernate.eclipse.hqleditor.HQLEditor.executeQuery(HQLEditor.java:406)
at org.hibernate.eclipse.console.actions.ExecuteQueryAction.execute(ExecuteQueryAction.java:72)
at org.hibernate.eclipse.console.actions.ExecuteQueryAction.run(ExecuteQueryAction.java:52)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.hibernate.eclipse.console.actions.ExecuteQueryAction.runWithEvent(ExecuteQueryAction.java:56)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:443)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1101)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3319)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
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)
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-2068) TransientObjectException : object references an unsaved transient instance ...
by Ales PROCHAZKA (JIRA)
TransientObjectException : object references an unsaved transient instance ...
------------------------------------------------------------------------------
Key: HHH-2068
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2068
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.cr4
Environment: Windows, Hibernate 3.2.0.cr4, Oracle 9.2.0.1
Reporter: Ales PROCHAZKA
Attachments: XTest.zip
I found this problem:
If I create new object 'o1', which associate another persistent object 'o2' and by calling saveOrUpdate Hibernate throws PropertyValueException,
then when I corresct this property and try call saveOrUpdate in another session (in which 'o2' was not saved or loaded) Hibernate throws TransientObjectException.
Please see attached code :-)
This is a log :
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: insert into T_TEST (A_POKUS, A_POKUS_LONG, CID, PK) values (?, ?, 3, ?)
Hibernate: insert into T_TEST3 (PK) values (?)
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: select hibernate_sequence.nextval from dual
org.hibernate.PropertyValueException: not-null property references a null or transient value: persistent.Test5.pokus
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:284)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:509)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:501)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:497)
at test.MainTest.test(MainTest.java:71)
at test.MainTest.main(MainTest.java:42)
org.hibernate.TransientObjectException: persistent.Test3
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:216)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:221)
at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:476)
at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:2900)
at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:474)
at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:197)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:120)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:993)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:340)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at test.MainTest.test(MainTest.java:87)
at test.MainTest.main(MainTest.java:42)
Thanx
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (ANN-755) Cascade operations don't take affect through a @CollectionOfElements
by Chris L (JIRA)
Cascade operations don't take affect through a @CollectionOfElements
--------------------------------------------------------------------
Key: ANN-755
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-755
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga
Environment: Hibernate 3.2.5
Reporter: Chris L
Consider having three classes. The first is an @Entity called a View, which has a collection of @Embeddable Column objects. Column objects have an @ManyToOne relationship to a @Entity called Filter.
The three classes have a very straightforward mapping:
@javax.persistence.Entity()
@Entity(dynamicUpdate=true)
@Table(name="PORTFOLIO_VIEW")
class View {
....
@JoinTable(name="PORTFOLIO_VIEW_COLUMN",joinColumns={@JoinColumn(name="VIEW_ID")})
@IndexColumn(name="COLUMN_INDEX")
@Cascade(CascadeType.ALL)
@LazyCollection(LazyCollectionOption.FALSE)
@CollectionOfElements
private List<Column> columns;
....
}
@Embeddable
class Column {
....
@ManyToOne(fetch=FetchType.EAGER)
@Cascade(CascadeType.ALL)
@JoinColumn(name="FILTER")
@Target(FilterImpl.class)
private Filter filter;
....
}
@javax.persistence.Entity
@Entity(dynamicUpdate=true)
@Table(name="FILTER")
@DiscriminatorColumn(name="CLASS_NAME",length=255)
abstract class FilterImpl {
....
}
When I create a new view, with a new column and filter object, I should be able to save the view and have the @Cascade settings on the @CollectionOfElements and the @ManyToOne inside of Column take affect, and save the Filter. Instead, I get a TransientObjectException because the Filter hasn't been saved yet.
I know I could work around this by either making Column an Entity, or by adding code to save the Filter before saving the View. But it seems to me this is reasonable usage of an Embeddable.
This issue was originally part of a forum post http://forum.hibernate.org/viewtopic.php?t=987977
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-3334) Cascading breaks if parent table doesn't have Auto-inc
by Wallace Wadge (JIRA)
Cascading breaks if parent table doesn't have Auto-inc
------------------------------------------------------
Key: HHH-3334
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3334
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.3.0.CR1, 3.2.6, 3.2.5, 3.2.4.sp1
Environment: tested on MySql, and hibernate versions (with annotations) v3.2.4 to 3.3.0CR1
Reporter: Wallace Wadge
(reposting here from forum)
Consider:
- a table with an assigned PK (i.e. not auto-increment), let's call this "A"
- Another table ("B") linked to the table listed above but with it's PK set to auto-increment.
Now if you try to save B with cascading switched on, it will break. From the little debugging I've done it looks like:
a) hibernate detects that A needs to be saved first, but puts it into some sort of queue.
b) when it hits B, it short-circuits this save queue and tries to save B immediately so as to obtain a PK reference for B. This fails since A hasn't been yet been saved so it's link is still null.
Schema used is listed below (MySQL):
----
CREATE DATABASE `jira` /*!40100 DEFAULT CHARACTER SET latin1 */;
DROP TABLE IF EXISTS `jira`.`parent`;
CREATE TABLE `jira`.`parent` (
`parent_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `jira`.`child`;
CREATE TABLE `jira`.`child` (
`child_id` int(10) unsigned NOT NULL auto_increment,
`parent_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`child_id`),
KEY `FK_child_1` (`parent_id`),
CONSTRAINT `FK_child_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-3006) ConcurrentModificationException in AbstractBatcher results in infinite loop
by Stefan Hauk (JIRA)
ConcurrentModificationException in AbstractBatcher results in infinite loop
---------------------------------------------------------------------------
Key: HHH-3006
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3006
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5, 3.2.4.sp1, 3.2.4, 3.2.3
Environment: Hibernate 3.2.5.ga
MySQL 5.0.42
Reporter: Stefan Hauk
Priority: Minor
Here is a piece of code from org.hibernate.jdbc.AbstractBatcher's closeStatements() method:
Iterator iter = resultSetsToClose.iterator();
while ( iter.hasNext() ) {
try {
logCloseResults();
( (ResultSet) iter.next() ).close();
}
catch (SQLException e) {
// no big deal
log.warn("Could not close a JDBC result set", e);
}
catch (Throwable e) {
// sybase driver (jConnect) throwing NPE here in certain cases
log.warn("Could not close a JDBC result set", e);
}
}
resultSetsToClose.clear();
In case there is a ConcurrentModificationException thrown when iterating over the resultSetsToClose HashSet the exception will be caught by the catch(Throwable) clause. However, the iteration may continue infinitely because of the corrupted HashSet. This pegs one CPU and logs the following stack trace over and over again:
28/11 20:16:50 WARN AbstractBatcher [resin-tcp-connection-myserver:6001-15] Could not close a JDBC result set
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
at java.util.HashMap$KeyIterator.next(HashMap.java:877)
at org.hibernate.jdbc.AbstractBatcher.closeStatements(AbstractBatcher.java:314)
at org.hibernate.jdbc.ConnectionManager.cleanup(ConnectionManager.java:382)
at org.hibernate.jdbc.ConnectionManager.close(ConnectionManager.java:324)
at org.hibernate.impl.SessionImpl.close(SessionImpl.java:298)
at org.springframework.orm.hibernate3.SessionFactoryUtils.closeSession(SessionFactoryUtils.java:774)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.closeSession(OpenSessionInViewFilter.java:252)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:183)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:188)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:419)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:492)
at com.caucho.util.ThreadPool.run(ThreadPool.java:425)
at java.lang.Thread.run(Thread.java:595)
The catch(Throwable) block was added in Hibernate 3.2.3 if I saw that correctly. Apparently the reason was to catch a NPE thrown by a sybase driver here, but catching Throwable catches more than that and produces this side-effect.
Now I do realize that the ConcurrentModificationException might be caused by not using Hibernate in a correct way, but I haven't determined the cause for it yet. However, I do think that Hibernate should fail more gracefully than it currently does.
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-3191) QueryPlanCache cache size
by Julien Kirch (JIRA)
QueryPlanCache cache size
-------------------------
Key: HHH-3191
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3191
Project: Hibernate3
Issue Type: Improvement
Components: query-hql
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6, all platform
Reporter: Julien Kirch
On a large application with many (currently 696) named queries in hbm files we have a performance issue with the QueryPlanCache cache size:
The SoftLimitMRUCache used in the QueryPlanCache use 128 hard references, the other being soft references, and this number is hardcoded.
As we have much more querries in the application, we spend much time in recompiling the same queries when they are evicted from the cache.
As the QueryPlanCache has a SessionFactoryImplementor as parameter, adding a new parameter to define the query cache plan size would be trivial; what's your opinion about this ?
--
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
14 years, 4 months