Skip to content

Instantly share code, notes, and snippets.

View sebersole's full-sized avatar

Steve Ebersole sebersole

View GitHub Profile
@sebersole
sebersole / gist:6041296
Created July 19, 2013 18:26
Initial rev of LoadPlan tree dumping
11:24:47,433 DEBUG LoadPlanTreePrinter:70 - LoadPlan(entity=org.hibernate.test.loader.EntityWithNonLazyOneToManyListResultSetProcessorTest$Poster)
- Returns
- EntityReturnImpl(entity=org.hibernate.test.loader.EntityWithNonLazyOneToManyListResultSetProcessorTest$Poster, querySpaceUid=<gen:0>, path=org.hibernate.test.loader.EntityWithNonLazyOneToManyListResultSetProcessorTest$Poster)
- CollectionFetchImpl(collection=org.hibernate.test.loader.EntityWithNonLazyOneToManyListResultSetProcessorTest$Poster.messages, querySpaceUid=<gen:1>, path=org.hibernate.test.loader.EntityWithNonLazyOneToManyListResultSetProcessorTest$Poster.messages)
- (collection element) CollectionFetchableElementEntityGraph(entity=org.hibernate.test.loader.EntityWithNonLazyOneToManyListResultSetProcessorTest$Message, querySpaceUid=<gen:2>, path=org.hibernate.test.loader.EntityWithNonLazyOneToManyListResultSetProcessorTest$Poster.messages.<elements>)
- QuerySpaces
- EntityQuerySpaceImpl(uid=<gen:0>,
public class OgmIntegration extends IntegrationSupport {
// for argument sake, this is the only type of contributions we care about...
@Override
public List<SessionFactoryServiceRegistryContributor> getSessionFactoryServiceRegistryContributors() {
return java.util.Arrays.asList(
new SessionFactoryServiceRegistryContributor() {
public void contribute(SessionFactoryServiceRegistry registry) {
// do some stuff with the registry
...
@Embeddable
class Address {
...
@Convert(...) private String city;
}
@Entity
@Convert(attributeName="homeAddress.city", disableConversion=true)
class Person {
<xsd:complexType name="embedded">
<xsd:annotation>
<xsd:documentation>
@Target({METHOD, FIELD}) @Retention(RUNTIME)
public @interface Embedded {}
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="attribute-override" type="orm:attribute-override" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="association-override" type="orm:association-override" minOccurs="0" maxOccurs="unbounded"/>
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
repositories {
mavenCentral()
mavenRepo name: 'jboss-nexus', url: "http://repository.jboss.org/nexus/content/groups/public/"
}
@sebersole
sebersole / ClassPropertyHolder.java
Created September 5, 2013 04:25
In ClassPropertyHolder, I have the following code that is performed during construction...
protected Map<String, AttributeConversionInfo> buildAttributeConversionInfoMap(XClass entityXClass) {
final HashMap<String, AttributeConversionInfo> map = new HashMap<String, AttributeConversionInfo>();
collectAttributeConversionInfo( map, entityXClass );
return map;
}
protected void collectAttributeConversionInfo(Map<String, AttributeConversionInfo> infoMap, XClass xClass) {
if ( xClass == null ) {
@Test
public void basicTest() {
// just making sure we can add one and that it is usable when we get it back
EntityManager em = getOrCreateEntityManager();
Query query = em.createQuery( "from Item" );
final String name = "myBasicItemQuery";
em.getEntityManagerFactory().addNamedQuery( name, query );
Query query2 = em.createNamedQuery( name );
jar {
manifest = osgiManifest { manifest ->
classesDir = sourceSets.main.output.classesDir
classpath = configurations.runtime
instruction 'Bundle-Vendor', 'Hibernate.org'
OsgiManifestPackagingInfo.buildInfo( project ).applyTo( manifest )
instruction 'Implementation-Url', 'http://hibernate.org'
Specifically here the phrase "is not recognized" is in question. In our opinion there are 2 problems with the JPA provider accepting such properties at the EntityManager level:
* Unnecessary growth of the map used to hold these properties
* Misleading feedback when/if EntityManager#getProperties() is later called (here it would look like some BV config is in use when it is not).
I understand that the wording in the javadoc makes what the TCK does allowable, but in my opinion the intent is incorrect and we ask that this be changed. There are other properties that actually have meaning at the EntityManager level that could be used to test this instead.
@sebersole
sebersole / EntityTypeMetadata
Last active August 29, 2015 13:57
Entity/MappedSuperclass - alternative
class EntityTypeMetadata extends IdentifiableTypeMetadata {
private MappedSuperclassTypeMetadata mappedSuperclass;
private EntityTypeMetadata superType;
...
}