Skip to content

Instantly share code, notes, and snippets.

@gbadner
gbadner / gist:1023040
Created June 13, 2011 15:52
How to resolve type in metamodel?
How should persisters get property type (i.e. o.h.type.Type)?
Alternatives:
1) in MetamodelImpl: new MetamodelTypeResolver( this ).resolve();
2) in persisters: attributeBinding.getType( typeResolver );
- typeResolver would be the TypeResolver scoped to the SessionFactory
@gbadner
gbadner / gist:1023221
Created June 13, 2011 17:18
How should entity modes be dealt with in new metamodel?
IIRC, an entity can only exist in one entity mode per SessionFactory.
If this is correct, then o.h.metamodel.domain.Entity does not need:
private final PojoEntitySpecifics pojoEntitySpecifics = new PojoEntitySpecifics();
private final Dom4jEntitySpecifics dom4jEntitySpecifics = new Dom4jEntitySpecifics();
private final MapEntitySpecifics mapEntitySpecifics = new MapEntitySpecifics();
It only needs:
@gbadner
gbadner / gist:1035866
Created June 20, 2011 15:54
ClassHolder
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@gbadner
gbadner / gist:1035874
Created June 20, 2011 15:57
MetadataImpl ClassHolder usage
@Override
public ClassHolder getOrCreateClassHolder(String className) {
ClassHolder classHolder = classHoldersByName.get( className );
if ( classHolder == null ) {
classHolder = ClassHolderImpl.createDeferredClassHolder( className, classLoaderService() );
classHoldersByName.put( className, classHolder );
}
return classHolder;
}
@gbadner
gbadner / gist:1035881
Created June 20, 2011 16:00
ClassHolderImpl
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
Bind global configuration (which are done already???)
(schema, catalog, imports, filters, fetch profiles, identifier generators, typedefs, named/native queries, resultset, auxiliary database object, etc)
Schema tools need to support persistent ID generators
(sequences and other IDs requiring DB objects will not work until this is fixed)
Use case examples:
A) Inheritance (not all are jpa)
1) table per class hierarchy (done?)
2) table per subclass
@gbadner
gbadner / gist:3100482
Created July 12, 2012 19:48
Determining if a backref is needed
Remove BackrefAttributeBinding creation from Binder.
Add the following to EntityBinding:
private Set<PluralAttributeKeyBinding> referencingPluralAttributeKeyBindings;
public void addReferencingPluralAttributeKeyBinding(PluralAttributeBinding pluralAttributeKeyBinding) {
referencingPluralAttributeKeyBindings.add( pluralAttributeKeyBinding );
}
@gbadner
gbadner / gist:3168141
Created July 24, 2012 05:07 — forked from stliu/gist:3141182
hibernate metamodel branch progress

This document is supposed to be used as a tracker of the progress of hibernate metamodel branch.

We want a uniform place to track the progress, so I use this instead of JIRA.

There are 5 major works shoulb be done to complete a mapping:

  • source
  • binding
  • binder
  • persister
@gbadner
gbadner / gist:3177636
Created July 25, 2012 18:12 — forked from stliu/gist:3141182
hibernate metamodel branch progress

This document is supposed to be used as a tracker of the progress of hibernate metamodel branch.

We want a uniform place to track the progress, so I use this instead of JIRA.

There are 5 major works shoulb be done to complete a mapping:

  • source
  • binding
  • binder
  • persister
@gbadner
gbadner / gist:7592399
Created November 22, 2013 00:16
Failure: com/sun/ts/tests/jpa/ee/propagation/cm/extended/Client.java#test6
\u001b[0m\u001b[0m22:45:22,635 INFO [stdout] (Thread-188) ************************************************************
\u001b[0m\u001b[0m22:45:22,879 INFO [stdout] (Thread-188) 11-20-2013 22:45:22: ERROR: Unexpected Exception :
\u001b[0m\u001b[0m22:45:22,884 INFO [stdout] (Thread-188) 11-20-2013 22:45:22: ERROR: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: Transaction was rolled back in a different thread!
\u001b[0m\u001b[0m22:45:22,885 INFO [stdout] (Thread-188) at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:190)
\u001b[0m\u001b[0m22:45:22,886 INFO [stdout] (Thread-188) at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)
\u001b[0m\u001b[0m22:45:22,886 INFO [stdout] (Thread-188) at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:340)
\u001b[0m\u001b[0m22:45:22,887 INFO [stdout] (Thread-188) at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxIn