Skip to content

Instantly share code, notes, and snippets.

View sebersole's full-sized avatar

Steve Ebersole sebersole

View GitHub Profile
@sebersole
sebersole / Caller.java
Last active May 27, 2020 14:15
LoadEventListener - continuation approach
LoadEventHandler handler = ...;
EventListenerGroup<LoadEventListener> listenerGroup = ...;
listenerGroup.withListeners(
(listeners) -> {
if ( listeners == null ) {
// short-circuit
return handler.load( ... );
}
else if ( listeners.length == 1 ) {
@sebersole
sebersole / LoadEventHandler.java
Last active May 26, 2020 14:57
LoadEventHandler
interface LoadEventHandler {
/**
* Perform the load
*/
Object load(
String entityName,
Object id,
LockMode lockMode,
LoadType loadType,
SessionImplementor session);
card 0: PCH [HDA Intel PCH], device 0: ALC257 Analog [ALC257 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
[ 24.472153] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC257: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
[ 24.472155] snd_hda_codec_realtek hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[ 24.472156] snd_hda_codec_realtek hdaudioC0D0: hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[ 24.472157] snd_hda_codec_realtek hdaudioC0D0: mono: mono_out=0x0
[ 24.472158] snd_hda_codec_realtek hdaudioC0D0: inputs:
[ 24.472159] snd_hda_codec_realtek hdaudioC0D0: Mic=0x19
[ 24.472160] snd_hda_codec_realtek hdaudioC0D0: Internal Mic=0x12
...
TableGroupImpl ... {
private final TableReference primaryRef;
private final BiFunction<TableReference,String,TableReferenceJoin> joinCreator;
private List<TableReferenceJoin> tableJoins;
...
@Override
public TableReference resolveTableReference(String tableExpression) {
if ( primaryRef... ) {
@sebersole
sebersole / concurrency-test.java
Last active October 19, 2019 14:11
Concurrency testing
@Test
public void testQueryConcurrency(SessionFactoryScope scope) throws InterruptedException {
final int numberOfIterations = 40;
final int numberOfForks = 5;
final ExecutorService executor = Executors.newFixedThreadPool( 5 );
final List<Future<String>> futures = CollectionHelper.arrayList( numberOfIterations * numberOfForks );
try {
@Test
public void testCustomProviderPassingIntegrationOverrides() {
PersistenceProvider provider = new HibernatePersistence() {
@Override
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map properties) {
properties.putAll( ConnectionProviderBuilder.getConnectionProviderProperties() );
return super.createContainerEntityManagerFactory( info, properties );
}
};
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:
@sebersole
sebersole / gist:f2c000c50cce19ab01c50a6a8fa1640b
Created April 29, 2019 22:17 — forked from gbadner/gist:a9cb2b5547aeddf96c36cb6108e72403
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:
[sebersole@t460p hibernate-core]$ gradlew -m release
:release SKIPPED
:hibernate-core:antlr SKIPPED
:hibernate-core:xjc SKIPPED
:hibernate-core:compileJava SKIPPED
:hibernate-core:processResources SKIPPED
:hibernate-core:classes SKIPPED
:hibernate-core:osgiClasses SKIPPED
:hibernate-core:jar SKIPPED