[Hibernate-JIRA] Created: (HHH-2022) ORA-00911: invalid character when field begins with underscore
by Jerry Cattell (JIRA)
ORA-00911: invalid character when field begins with underscore
--------------------------------------------------------------
Key: HHH-2022
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2022
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.0.5, 3.1.3, 3.2.0.cr3
Environment: Hibernate 3.1.3
Oracle 10.2.0.1
Reporter: Jerry Cattell
Priority: Minor
Attachments: InvalidCharacterErrorCase.java, SimpleObject.hbm.xml, SimpleObject.java
Hibernate is generating invalid SQL (for Oracle) for collections that are stored in fields with names that start with underscores.
In this SQL:
Hibernate: select _tags0_.SIMPLE_OBJECT_ID as SIMPLE1_0_, _tags0_.TAG as TAG0_ from SIMPLE_OBJECT_TAG _tags0_ where _tags0_.SIMPLE_OBJECT_ID=?
an alias called "_tags0_" is created for the collection table. Unfortunately, Oracle does not allow non-alphabetic characters for the first character in an alias.
Here's the stacktrace:
Hibernate: select _tags0_.SIMPLE_OBJECT_ID as SIMPLE1_0_, _tags0_.TAG as TAG0_ from SIMPLE_OBJECT_TAG _tags0_ where _tags0_.SIMPLE_OBJECT_ID=?
WARN JDBCExceptionReporter 20060822-011120.817 - SQL Error: 911, SQLState: 42000
ERROR JDBCExceptionReporter 20060822-011120.818 - ORA-00911: invalid character
INFO DefaultLoadEventListener 20060822-011120.820 - Error performing load command
org.hibernate.exception.SQLGrammarException: could not initialize a collection: [SimpleObject._tags#1]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1926)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1676)
at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:454)
at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:755)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:229)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:47)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:41)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:161)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:799)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:792)
at InvalidCharacterErrorCase.runTest(InvalidCharacterErrorCase.java:28)
at InvalidCharacterErrorCase.main(InvalidCharacterErrorCase.java:11)
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:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.sql.SQLException: ORA-00911: invalid character
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1132)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
... 26 more
I have attached a test case that causes this error.
After a little bit of research, it appears that a change to StringHelper.generateAlias(String description, int unique) (or StringHelper.generateAliasRoot(String description)) to remove all characters up to the first alphabetic character would solve this problem.
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (HSHARDS-9) Add ShardAware interface and related exit strategy logic
by Nathan Silberman (JIRA)
Add ShardAware interface and related exit strategy logic
--------------------------------------------------------
Key: HSHARDS-9
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSHARDS-9
Project: Hibernate Shards
Issue Type: New Feature
Components: strategy
Affects Versions: 3.0.0.Beta1
Environment: Hibernate 3.2, Database: DB2
Reporter: Nathan Silberman
Assignee: Max Ross
Domain model awareness of its host Shard. Any domain model that implemented a 'ShardAware' interface would contain a Set<ShardId> that could be injected by the relevant ExitStrategy.
This could be solved by adding the following interface:
-------------------------------------------------------
package org.hibernate.shards;
import org.hibernate.shards.ShardId;
import java.util.Set;
/**
* Interface for persistent objects that are aware of the virtual shardIds
* that host them.
*/
public interface ShardAware {
/**
* Sets the virtual ShardIds that host the implementing
* persistant object
*
* @param shardid
* a non-null, non-empty Set of ShardIds
* @throws IllegalArgumentException
* if <tt>shardIds</tt> is null or empty
*/
void setShardIds( Set<ShardId> shardids );
}
---------------------------------------------------
An simple exit strategy that could be used, for example, would set the ShardIds for each resulting ShardAware domain model:
------------------------------------------------------
package org.hibernate.shards.strategy.exit;
import java.util.List;
import org.hibernate.shards.Shard;
import org.hibernate.shards.ShardAware;
/**
* ShardAwareConcatenateListsExistStrategy sets the ShardIds on each of the given
* objects returned by each Shard.
*
* One should be aware that usage of this class adds O(n) overhead to each retrieval
* as the setting of each ShardIds Set is invoked by iterating over the entire resultSet.
*/
public class ShardAwareConcatenateListsExistStrategy extends ConcatenateListsExitStrategy {
@Override
public synchronized boolean addResult(List<Object> oneResult, Shard shard ) {
if ( oneResult != null && ! oneResult.isEmpty()
&& oneResult.get( 0 ) instanceof ShardAware ) {
for( Object object : oneResult ) {
((ShardAware)object).setShardIds( shard.getShardIds() );
}
}
return super.addResult( oneResult, shard );
}
}
---------------------------------------
This change might require changes wherever ShardAccessStrategy.apply() could be invoked.
I have made the changes including a small alteration to the ShardedCriteriaImpl, to use ShardAwareConcatenateListsExistStrategy instead of ConcatenateListsExitStrategy, with success.
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (HHH-2620) Hibernate and Unicode
by Maneesh Chauhan (JIRA)
Hibernate and Unicode
---------------------
Key: HHH-2620
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2620
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.1.3
Environment: Window and Linux , Mysql 5.0
Reporter: Maneesh Chauhan
HI All ,
In My project i would like to insert the multiple language characters like chinese,japanese , Denmark etc . For this , i setup my mysql database with character set utf8 and in the hibernate configuration file connection url is like this
connection.url = jdbc:mysql://localhost/multibyte?useUnicode=true&characterEncoding=UTF-8
But when i am trying to insert the chinese characters in the database by using the hibernate then it shows ???? characters and i retrieve the same row from the database by using hibernate then i got the ????
Please let me know is there any more change should i will have to make to run the things smoothly
Thanks in advance
Maneesh Chauhan
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (HBX-960) Missing bundle constraint with eclipse 3.3
by Christoph Mayerhofer (JIRA)
Missing bundle constraint with eclipse 3.3
------------------------------------------
Key: HBX-960
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-960
Project: Hibernate Tools
Issue Type: Bug
Components: eclipse
Affects Versions: 3.2beta9
Environment: Eclipse Version: 3.3.0, Build id: I20070625-1500
Hibernate-Tools 3.2.0-beta9
Reporter: Christoph Mayerhofer
I tried to use Hibernate-Tools with the new Eclipse 3.3. I downloaded the current release of Eclipse 3.3 (June 25, 2007, eclipse-SDK-3.3-win32) and installed Hibernate-Tools 3.2beta9. After starting Eclipse I noticed that no Eclipse-Views of Hibernate-Tools are available, but the Hibernate plugin is visible under the 'Product Configuration' window.
I have tried to manually start the org.eclipse.hibernate.mapper plugin with the osgi-console (I started eclipse with -console). I got the error message, that the org.eclipse.wst.xml plugin could not be located.
166 <<LAZY>> org.eclipse.wst.common.core_1.1.100.v200608220540
167 INSTALLED org.eclipse.wst.common.environment_1.0.100.v200608251934
168 INSTALLED org.eclipse.wst.common.frameworks_1.1.1.v200609132124
169 INSTALLED org.eclipse.wst.common.project.facet.core_1.1.1.v200608112156
170 INSTALLED org.eclipse.wst.common.project.facet.ui_1.1.1.v200608112156
171 <<LAZY>> org.eclipse.wst.common.ui_1.1.100.v200608221521
172 <<LAZY>> org.eclipse.wst.common.uriresolver_1.1.100.v200609200443
173 INSTALLED org.eclipse.wst.dtd.core_1.1.1.v200609210600
174 INSTALLED org.eclipse.wst.sse.core_1.1.100.v200609182120
175 INSTALLED org.eclipse.wst.sse.ui_1.0.200.v200609211325
176 INSTALLED org.eclipse.wst.validation_1.1.1.v200609132124
177 INSTALLED org.eclipse.wst.xml.core_1.1.1.v200609210600
178 RESOLVED org.apache.xerces_2.8.0.v200606131651
179 INSTALLED org.hibernate.eclipse.console_3.2.0.beta9a
180 ACTIVE org.hibernate.eclipse.help_3.2.0.beta9a
181 INSTALLED org.hibernate.eclipse.mapper_3.2.0.beta9a
182 ACTIVE org.hibernate.eclipse_3.2.0.beta9a
183 ACTIVE org.jboss.ide.eclipse.freemarker_1.0.0.Beta2
osgi> start org.hibernate.eclipse.mapper
org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: Require-Bundle: org.eclipse.wst.xml.core; bundle-version="0.0.0"
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:305)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:252)
at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:260)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:145)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:291)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:276)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:218)
at java.lang.Thread.run(Unknown Source)
osgi>
So I downloaded the current wtp-package from the WTP Project Site (http://europa-mirror1.eclipse.org/webtools/downloads/drops/R2.0/R-2.0-200...), installed it, and now it works.
--
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
17 years, 4 months