Skip to content

Instantly share code, notes, and snippets.

@gbadner
gbadner / gist:a9cb2b5547aeddf96c36cb6108e72403
Created April 29, 2019 22:16
Cases for HibernateProxy with enhancement
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 February 6, 2016 03:10
Overview of OperationContext design
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 October 1, 2014 22:11
NamingStrategyDelegator/NamingStrategyDelegate (not good names; need to change...)
/**
* Provides access to the appropriate {@link NamingStrategyDelegate}.
*
* @author Gail Badner
*/
public interface NamingStrategyDelegator {
public void injectNamingStrategy(NamingStrategy namingStrategy);
/**
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 August 29, 2015 14:06
Objects needing logical/physical names
Table names:
Primary table
Currently generated by: NamingStrategy.classToTableName(String className)
Input: LogicalPrimaryTableNameSource
Secondary table:
Element collection table name:
Inputs:
public interface Mappings {
...
/**
* Get the current naming strategy.
*
* @return The current naming strategy.
*/
@deprecated
public NamingStrategy getNamingStrategy();
@gbadner
gbadner / gist:9099683
Created February 19, 2014 19:28
Different types of Type
(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 January 27, 2014 13:22
"Integration" failures due to replacing org.hibernate.metamodel
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 January 13, 2014 20:00
SelectGenerator diff
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 January 7, 2014 23:03
Commits to o.h.metamodel in master branch (not in metamodel branch)
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