[Hibernate-JIRA] Created: (HHH-2990) Bad usage of ClassLoader.loadClass() for Java6 in SerializationHelper$CustomObjectInputStream - deserialization bottleneck for arrays
by Tom Eicher (JIRA)
Bad usage of ClassLoader.loadClass() for Java6 in SerializationHelper$CustomObjectInputStream - deserialization bottleneck for arrays
-------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2990
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2990
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5, Java 6 Sun (any), any platform (tested Linux x64, Mac x64 (J6dp1))
Reporter: Tom Eicher
Sun has "clarified" (others say modified) the API of "ClassLoader.loadClass()" and no longer allows this to be called for arrays, e.g. String[].
( see: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6500212 and duplicates )
and states that this has always been very unstable to use/do in the first place.
So trying to load an array of something using this method results in ClassNotFoundException.
The correct thing to do is call Class.forName(className,false,myClassLoader); instead of myClassLoader.loadClass(className);
In SerializationHelper$CustomObjectInputStream.resolveClass() we do
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try {
resolvedClass = loader.loadClass(className);
log.trace("Class resolved through context class loader");
}
catch(ClassNotFoundException e) {
log.trace("Asking super to resolve");
resolvedClass = super.resolveClass(v);
}
which results in the deserialization process for a String[] always searching String[] in all the application's jars/wars/etc before really loading it.
The bad thing is, loadClass() is synchronized.
In our case, we have multiple threads loading database rows containing String[]s, which results in one Thread doing
INFO | jvm 1 | 2007/11/30 16:56:44 | java.lang.Thread.State: RUNNABLE
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.util.zip.ZipFile.getEntry(Native Method)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.util.zip.ZipFile.getEntry(ZipFile.java:149)
INFO | jvm 1 | 2007/11/30 16:56:44 | - locked <0x00002aaab4047c20> (a java.util.jar.JarFile)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.util.jar.JarFile.getEntry(JarFile.java:206)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.util.jar.JarFile.getJarEntry(JarFile.java:189)
INFO | jvm 1 | 2007/11/30 16:56:44 | at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:754)
INFO | jvm 1 | 2007/11/30 16:56:44 | at sun.misc.URLClassPath.getResource(URLClassPath.java:168)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.net.URLClassLoader$1.run(URLClassLoader.java:192)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.security.AccessController.doPrivileged(Native Method)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
INFO | jvm 1 | 2007/11/30 16:56:44 | - locked <0x00002aaab4025998> (a org.apache.catalina.loader.StandardClassLoader)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
INFO | jvm 1 | 2007/11/30 16:56:44 | - locked <0x00002aaab4095a68> (a org.apache.catalina.loader.StandardClassLoader)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
INFO | jvm 1 | 2007/11/30 16:56:44 | at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1346)
INFO | jvm 1 | 2007/11/30 16:56:44 | at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
INFO | jvm 1 | 2007/11/30 16:56:44 | at org.hibernate.util.SerializationHelper$CustomObjectInputStream.resolveClass(SerializationHelper.java:263)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1624)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
INFO | jvm 1 | 2007/11/30 16:56:44 | at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:210)
and all other threads doing nothing
INFO | jvm 1 | 2007/11/30 16:56:44 | java.lang.Thread.State: BLOCKED (on object monitor)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
INFO | jvm 1 | 2007/11/30 16:56:44 | - waiting to lock <0x00002aaab4095a68> (a org.apache.catalina.loader.StandardClassLoader)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
INFO | jvm 1 | 2007/11/30 16:56:44 | at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1346)
INFO | jvm 1 | 2007/11/30 16:56:44 | at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
INFO | jvm 1 | 2007/11/30 16:56:44 | at org.hibernate.util.SerializationHelper$CustomObjectInputStream.resolveClass(SerializationHelper.java:263)
INFO | jvm 1 | 2007/11/30 16:56:44 | at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
(rest of stack trace identical to above)
This can easily be worked around by setting the compatibility property
-Dsun.lang.ClassLoader.allowArraySyntax=true
however a) this workaround might not be around for long and b) most people will never find this bottleneck, therefore will not apply the workaround.
For our case, we got a 35% performance increase just be setting this property (and not a single loadClass() or ZipFile.getEntry() in any thread dump any more).
Cheers, Tom.
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HBX-951) Folder selection dialog should allow creating a new folder
by Dan Allen (JIRA)
Folder selection dialog should allow creating a new folder
----------------------------------------------------------
Key: HBX-951
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-951
Project: Hibernate Tools
Issue Type: Improvement
Components: eclipse
Affects Versions: 3.2beta9, 3.2beta10
Environment: Eclipse 3.2.2
Hibernate Tools beta10
Reporter: Dan Allen
Attachments: new_folder.png
The folder selection dialog used by the Hibernate Code Generation... definition screen (Main tab, Output directory) does not allow creating new folders. The lack of this feature is very inconvenient.
For instance, if I would like to export my schema to HTML documentation, I go into the tool to setup a new Exporter. But I cannot create a new folder to put the docs. So I have to quit the dialog, go create a new folder using the Eclipse File > New > Folder dialog. Then I have to go back into the tool and configure it to use this folder.
The attached screenshot shows what I am looking for.
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (HHH-2897) Adding support for use of sequence objects in DB2 V8 OS390
by Tobias Sternvik (JIRA)
Adding support for use of sequence objects in DB2 V8 OS390
----------------------------------------------------------
Key: HHH-2897
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2897
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.5
Environment: Hibernate Core 3.2.5ga, DB2 UDB V8 OS390 (Z/OS)
Reporter: Tobias Sternvik
Attachments: DB2390Dialect.java
Since version 8 of DB2 sequence objects are supported on the OS390 platform. But, the syntax for use of sequences varies between OS390 platform and the "rest".
For retreival of next value in DB2 OS390 the syntax is "select nextval for <theSequenceName> from sysibm.sysdummy1" while in the "rest" it is "values nextval for <theSequenceName>". There migt be the case that within AS/400 environment the syntax is imilar to OS390, but I have not verified this.
Also other differences exists..
I've included a enhanced verion of DB2390Dialect.java that has been proven to work in DB2 mainframe environment.
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (ANN-748) @JoinColumn overrides scale and percision in ManyToOne map..
by Andrew C. Oliver (JIRA)
@JoinColumn overrides scale and percision in ManyToOne map..
------------------------------------------------------------
Key: ANN-748
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-748
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.4.0.CR1
Environment: Postgresql but not Hypersonic (haven't tried other DBs, but suspect any real non-java db will replicate)
Reporter: Andrew C. Oliver
Attachments: patch.tar.gz
http://forum.hibernate.org/viewtopic.php?t=987527
Since you asked nicely...
This is a patch against your test cases.
Sorry for the not patch style patch. It is against the latest download of Annotations (3.4.0.CR1). I'm on a hotel network that seems to really make SVN angry.
There are 4 files:
1. Bunny has many
2. PointyTooth (teeth)
3. IdTest.java, only "testBlownPrecision" is new and "getMappings" includes the rabid bunny and teeth
4. UUIDGenerator - I wouldn't have included it but I couldn't find a decent way to autogenerate 128-bit keys. (The linked wikipedia article is amusing).
You'll probably want to unzip these into the annotations root directory, then do the svn diff. Following this you may want to pretty print.
As the test notes, it will FAIL with the @JoinColumn mapping and succeed if it is commented out. The failure notes a precision error. Obviously batching must be disabled to read it. If you look at the generated table it will have like NUMBER[19]. With JoinColumn commented out it is the expected NUMBER[128]. Thanks to PaaKow Acquah for finding this.
If you want more details, I'll be a TacoMac having another Aventinus...
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (ANN-666) @SQLInsert does not work
by Alex (JIRA)
@SQLInsert does not work
-------------------------
Key: ANN-666
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-666
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.2.1
Environment: hibernate-3.2.3.ga.zip, MySQL client version: 5.0.22, MSSQL 2005
Reporter: Alex
http://forum.hibernate.org/viewtopic.php?p=2367176#2367176
@Entity
@Table(name = "CONTACTS")
@SQLInsert(sql="INSERT INTO CONTACT(FIRST_NAME, LAST_NAME) VALUES(upper('aaa'),upper('bbb'))")
public class Contact {
// ...
}
I've tried the both - sql-query and stored procedure inside the @SQLInsert. But the both not work for me. It looks like the @SQLInsert annotation is just ignored for some reason. Usual "insert into CONTACT (FIRST_NAME, LAST_NAME) values (?, ?)" statement is generated despite of the @SQLInsert annotation. At the same time other annotations (@NamedNativeQuery, @Loader) work ok for the class.
How to make it works, please?
Thanks a lot in advance.
Hibernate version:
hibernate-3.2.3.ga.zip
Mapping documents:
sessionFactory = new AnnotationConfiguration()
.addPackage("model")
.addAnnotatedClass(Contact.class)
.addAnnotatedClass(SpaceShip.class)
.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLMyISAMDialect")
.setProperty("hibernate.connection.url", "jdbc:mysql://localhost/test")
.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver")
.setProperty("hibernate.connection.username", "usname")
.setProperty("hibernate.connection.password", "1231123")
.setProperty(Environment.HBM2DDL_AUTO, "update")
.setProperty(Environment.SHOW_SQL, "true")
.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.NoCacheProvider")
.buildSessionFactory();
Code between sessionFactory.openSession() and session.close():
session = HibernateUtil.getSession();
session.beginTransaction();
session.saveOrUpdate(newContact);
session.getTransaction().commit();
Full stack trace of any exception that occurs:
None
Name and version of the database you are using:
MySQL client version: 5.0.22
The generated SQL (show_sql=true):
Hibernate: insert into CONTACT (FIRST_NAME, LAST_NAME) values (?, ?)
--
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
15 years, 2 months