[hibernate-dev] Multiple joined-subclass mappings to same table

2015-02-10 Thread Unmesh Joshi
Hi,

I am bit puzzled with this. I am looking at a codebase, where there are
multiple joined-subclass mappings (in separate hbm.xml files) which map to
same table. For union-subclass, we correctly get exception for duplicate
mapping. But for joined-subclass it allows multiple mappings to same table.
In the hibernate source code, I see that for Joined subclass, the table
mapping is added with following method call.

Table mytable = mappings.addTable(
schema,
catalog,
getClassTableName( joinedSubclass, node, schema, catalog, null, mappings ),
getSubselect( node ),
false

For union-subclass, the mapping gets added with

Table mytable = mappings.addDenormalizedTable(
schema,
catalog,
getClassTableName(unionSubclass, node, schema, catalog,
denormalizedSuperTable, mappings ),
unionSubclass.isAbstract() != null && unionSubclass.isAbstract(),
getSubselect( node ),
denormalizedSuperTable
);

mappings.addTable doesnt throw exception if the table mapping already
exists.

Is the behaviour for joined subclass by design? Because I see this fact
being used in some projects, where to extend an already created
joined-subclass, a new hibernate-config file is added with joined-subclass
definition duplicated, with additional attributes (and columns) added to
existing table. So essentially, you have two joined-subclass definitions,
mapping two separate entities to same table.
This does look like using some loop hole in the code?

Thanks,
Unmesh
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


[hibernate-dev] large hql queries holding classloader lock for too long in weblogic

2008-12-29 Thread Unmesh joshi

Hi,

We had an issue in our project where large hql expressions holding on lock to 
ChangeAwareClassloader in weblogic. 
We had an hql query which was like 
 
select * from ClassA a where a.identifier = 'id1' or a.identifier='id2' or 
.  a.identifier='id1000'.

This was certainly bad to have this big or expression, but an issue this caused 
in weblogic is something interesting.
Hibernate query engine processes each identifier in a query to see if its a 
Java Class. So for each one of ClassA, a.identifier etc it calls Class.forName, 
if NoClassDefFound exception is thrown, ReflectHelper.getConstantValue returns 
null.

Now the problem is, if the expression is huge, recursive calls to 
/NodeTraverser.visitDepthFirst create huge stack trace. While building 
ClassNotFoundException, system class loader gets stuck to build all this stack 
trace. Because weblogic/utils/classloaders/ChangeAwareClassLoader.loadClass 
method is synchronized, any other thread trying to load any other class is 
blocked. If the stack trace is huge and taking consideratble amount of time to 
create Exception object, the lock is held for that much time, blocking every 
other thread trying to any the class. It brought down our servers in test 
environment.

Is this a known issue in weblogic and hibernate? I know that building such a 
large expression is bad(and we have already changed the code which was doing 
that), but the way its blocking the classloader in weblogic is an issue I 
think. 

Following is the thread dump.

"[STUCK] ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)'" 
id=614 idx=0x3f8 tid=15385 prio=1 alive, in native, daemon
at pthread_cond_wait@@GLIBC_2.3.2+170(:0)@0x318c008a7a
at vmtWaitUntilNotSoftSuspended+66(:0)@0x2a955e35c2
at find_codeinfo+138(:0)@0x2a955b032e
at cmFindStackCodeInfoWithHint+44(:0)@0x2a955b040e
at frameIterFindCodeInfo+19(:0)@0x2a9571b11f
at frameIterGetCurrentAndStep+130(:0)@0x2a9571b489
at jniFillInStackTrace+368(:0)@0x2a95630d25
at JVM_FillInStackTrace+9(:0)@0x2a95647661
at RJNI_jrockit_vm_Reflect_fillInStackTrace0+9(:0)@0x2a956f5983
at jrockit/vm/Reflect.fillInStackTrace0(Ljava/lang/Throwable;)V(Native 
Method)
at java/lang/Throwable.fillInStackTrace()Ljava/lang/Throwable;(Native 
Method)[optimized]
at java/lang/Throwable.(Throwable.java:218)[optimized]
at java/lang/Exception.(Exception.java:59)[inlined]
at 
java/lang/ClassNotFoundException.(ClassNotFoundException.java:65)[optimized]
at java/net/URLClassLoader$1.run(URLClassLoader.java:200)[inlined]
at 
jrockit/vm/AccessController.doPrivileged(AccessController.java:255)[inlined]
at java/net/URLClassLoader.findClass(URLClassLoader.java:188)[optimized]
at java/lang/ClassLoader.loadClass(ClassLoader.java:306)[optimized]
^-- Holding lock: java/net/urlclassloa...@0x4993580[thin lock]
at java/lang/ClassLoader.loadClass(ClassLoader.java:299)[optimized]
^-- Holding lock: 
weblogic/utils/classloaders/genericclassloa...@0x469e900[thin lock]
at java/lang/ClassLoader.loadClass(ClassLoader.java:251)[inlined]
at 
weblogic/utils/classloaders/GenericClassLoader.loadClass(GenericClassLoader.java:158)[optimized]
at 
weblogic/utils/classloaders/FilteringClassLoader.findClass(FilteringClassLoader.java:83)[inlined]
at 
weblogic/utils/classloaders/FilteringClassLoader.loadClass(FilteringClassLoader.java:68)[optimized]
at java/lang/ClassLoader.loadClass(ClassLoader.java:299)[optimized]
^-- Holding lock: 
weblogic/utils/classloaders/genericclassloa...@0x4969138[thin lock]
at java/lang/ClassLoader.loadClass(ClassLoader.java:299)[inlined]
at java/lang/ClassLoader.loadClass(ClassLoader.java:251)[inlined]
at 
weblogic/utils/classloaders/GenericClassLoader.loadClass(GenericClassLoader.java:158)[inlined]
at 
weblogic/utils/classloaders/ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:35)[optimized]
^-- Holding lock: 
weblogic/utils/classloaders/changeawareclassloa...@0x4915178[recursive]
at jrockit/vm/Classes.loadClassInternal(Classes.java:75)[optimized]
^-- Holding lock: 
weblogic/utils/classloaders/changeawareclassloa...@0x4915178[fat lock]
at jrockit/vm/RNI.c2java(J)V(Native Method)
at 
jrockit/vm/Classes.forName0(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;(Native
 Method)
at jrockit/vm/Classes.forName(Classes.java:125)[inlined]
at java/lang/Class.forName(Class.java:164)[inlined]
at 
org/hibernate/util/ReflectHelper.classForName(ReflectHelper.java:100)[inlined]
at 
org/hibernate/util/ReflectHelper.getConstantValue(ReflectHelper.java:122)[inlined]
at 
org/hibernate/hql/ast/QueryTranslatorImpl$JavaConstantConverter.handleDotStructure(QueryTranslatorImpl.java:569)[inlined]
at 
org/hibernate/hql/ast/QueryTranslatorImpl$JavaConstantConverter.visit(QueryTranslatorImpl.java:564)[optimized]
at 
org/hibernate/hql/ast/util/NodeTraverser.visi

[hibernate-dev] Why cglib was replaced with javassist?

2009-05-29 Thread Unmesh joshi

hi,
Till hibernate 3.2 cglib was default bytecode provider. why was it changed to 
javassist?
thanks,unmesh
_
Planning the weekend ? Here’s what is happening in your town.
http://msn.asklaila.com/events/___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev