Skip to content

Instantly share code, notes, and snippets.

@gbadner
gbadner / gist:a9cb2b5547aeddf96c36cb6108e72403
Created Apr 29, 2019
Cases for HibernateProxy with enhancement
View gist:a9cb2b5547aeddf96c36cb6108e72403
Enhanced Enhanced
allow_enhancement_as_proxy=true allow_enhancement_as_proxy=false Non-enhanced
Session#load: returns uninitialized, enhanced entity return enhanced entity that return entity
(entity/proxy (per HHH-11147) implements HibernateProxy that implements
not in PC HibernateProxy
yet)
LazyToOne:
@gbadner
gbadner / HHH-10478: OperationContext
Last active Feb 6, 2016
Overview of OperationContext design
View HHH-10478: OperationContext
Note: There are some details that need to be discussed. I will create a separate gist
for those details shortly.
POC: https://github.com/gbadner/hibernate-core/tree/HHH-10478-OperationContext
Design Overview
An OperationContext is intended to allow data important to an operation that is currently in progress,
that is needed in different areas of hibernate ORM code base. It allows data to be accessible without
having to pass it along as an argument from method to method to where it is needed.
@gbadner
gbadner / gist:9ab8f91d227470175f33
Created Oct 1, 2014
NamingStrategyDelegator/NamingStrategyDelegate (not good names; need to change...)
View gist:9ab8f91d227470175f33
/**
* Provides access to the appropriate {@link NamingStrategyDelegate}.
*
* @author Gail Badner
*/
public interface NamingStrategyDelegator {
public void injectNamingStrategy(NamingStrategy namingStrategy);
/**
View gist:1bceb7eb2eab59f7fcdf
diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Ejb3Column.java b/hibernate-core/src/main/java/org/hibernate/cfg/Ejb3Column.java
index c6a2856..c10a5ee 100644
--- a/hibernate-core/src/main/java/org/hibernate/cfg/Ejb3Column.java
+++ b/hibernate-core/src/main/java/org/hibernate/cfg/Ejb3Column.java
@@ -34,6 +34,7 @@ import org.hibernate.annotations.ColumnTransformers;
import org.hibernate.annotations.Index;
import org.hibernate.annotations.common.reflection.XProperty;
import org.hibernate.cfg.annotations.Nullability;
+import org.hibernate.cfg.naming.ImplicitAttributeColumnNameSource;
import org.hibernate.internal.CoreMessageLogger;
@gbadner
gbadner / gist:057dac7388205352765c
Last active Aug 29, 2015
Objects needing logical/physical names
View gist:057dac7388205352765c
Table names:
Primary table
Currently generated by: NamingStrategy.classToTableName(String className)
Input: LogicalPrimaryTableNameSource
Secondary table:
Element collection table name:
Inputs:
View gist:feed0e0413cedb7c364d
public interface Mappings {
...
/**
* Get the current naming strategy.
*
* @return The current naming strategy.
*/
@deprecated
public NamingStrategy getNamingStrategy();
@gbadner
gbadner / gist:9099683
Created Feb 19, 2014
Different types of Type
View gist:9099683
(11:26:53 AM) sebersole: i almost want to make it build the "domain model" first
(11:27:23 AM) sebersole: and use that to reference class names, attributes, etc
(11:27:34 AM) gbadner: +1
(11:28:03 AM) gbadner: I understand now why you had Type.getClassName() and getClassReference()
(11:29:00 AM) gbadner: it would be really nice if o.h.metamodel.spi.Type encapsulated HibernateTypeDescription
(11:29:15 AM) sebersole: it cant always
(11:29:30 AM) sebersole: especially in the case of composites
(11:29:56 AM) sebersole: think the distinction between Embeddable and Embedded
(11:30:13 AM) sebersole: Type would be the Embeddable
(11:30:28 AM) sebersole: HibernateTypeDescription would be the Embedded
@gbadner
gbadner / gist:8648491
Created Jan 27, 2014
"Integration" failures due to replacing org.hibernate.metamodel
View gist:8648491
org.hibernate.test.cid.CompositeIdWithGeneratorTest fails in master because new metamodel cannot handle an IdentityGenerator w/ more than one column. (was changed to IdentifierGenerator on metamodel branch).
org.hibernate.test.propertyref.basic.BasicPropertiesTest fails on master; not in metamodel branch.
Tests that extend BaseUnitTestCase (and not BaseCoreFunctionalTestCase) that explicitly build Configuration (requires merging changes to testing code from metamodel branch). For now, they throw NotYetImplementedException:
- org.hibernate.test.annotations.access.xml.XmlAccessTest
- org.hibernate.test.annotations.id.JoinColumnOverrideTest
- org.hibernate.test.annotations.id.sequences.JoinColumnOverrideTest
- org.hibernate.test.annotations.uniqueconstraint.UniqueConstraintValidationTest
- org.hibernate.test.cfg.cache.CacheConfigurationTest
- org.hibernate.test.nationalized.SimpleNationalizedTest
@gbadner
gbadner / gist:8406958
Created Jan 13, 2014
SelectGenerator diff
View gist:8406958
diff -r hibernate-core/src/main/java/org/hibernate/id/SelectGenerator.java ../hibernate-orm-metamodel-exact/hibernate-core/src/main/java/org/hibernate/id/SelectGenerator.java
26d25
<
37a37
> import org.hibernate.engine.spi.ValueInclusion;
84c84,85
< if ( persister.getEntityMetamodel().isNaturalIdentifierInsertGenerated() ) {
---
> ValueInclusion inclusion = persister.getPropertyInsertGenerationInclusions() [ naturalIdPropertyIndices[0] ];
> if ( inclusion != ValueInclusion.NONE ) {
@gbadner
gbadner / gist:8308553
Created Jan 7, 2014
Commits to o.h.metamodel in master branch (not in metamodel branch)
View gist:8308553
commit 8fe5460ec03942e974d4aae7d9060e20bab7f990
Author: Steve Ebersole <steve@hibernate.org>
Date: Sun Nov 24 20:07:37 2013 -0600
HHH-8741 - More checkstyle cleanups
commit cd590470c0059981537e558a5ff6d114fd24df61
Author: Steve Ebersole <steve@hibernate.org>
Date: Sun Nov 24 09:44:51 2013 -0600