Skip to content

Instantly share code, notes, and snippets.

View sebersole's full-sized avatar

Steve Ebersole sebersole

View GitHub Profile
public class Value<T> {
/**
* The snippet that generates the initialization value.
*
* @param <T>
*/
public static interface DeferredInitializer<T> {
/**
* Build the initialization value.
public enum CascadeType {
UPDATE,
PERSIST,
...;
private final CascasdeStyle correspondingCascadeStyle;
CascadeType(CascasdeStyle correspondingCascadeStyle) {
this.correspondingCascadeStyle = correspondingCascadeStyle;
}
[06/27/11 14:41] <gbadner> sebersole, might be worthwhile to also have EntityBinding.getDeclaredEntityIdentifier()
[06/27/11 14:41] <sebersole> why?
[06/27/11 14:41] <sebersole> declared/not is more a function of the domain model
[06/27/11 14:42] <sebersole> well not even more... it IS a ...
[06/27/11 14:42] <sebersole> guess i am not seeing the benefit of getDeclaredEntityIdentifier here...
[06/27/11 14:42] <sebersole> i really want to stay away from adding things "just because"
[06/27/11 14:43] <sebersole> thats gets you in trouble
[06/27/11 14:43] <sebersole> later
[06/27/11 14:43] <sebersole> if there is a reason and a need, fine
[06/27/11 14:43] <sebersole> thats different
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
jaxb:extensionBindingPrefixes="inheritance"
jaxb:version="2.1">
<jaxb:bindings schemaLocation="../resources/org/hibernate/hibernate-mapping-4.0.xsd" node="/xs:schema">
<jaxb:schemaBindings>
:hibernate-core:jaxb
[ant:xjc] [ERROR] XPath error: null
[ant:xjc] line 9 of file:/home/steve/projects/hibernate/4.0/hibernate-core/hibernate-core/src/main/xjb/hbm-mapping-bindings.xjb
[ant:xjc]
[ant:xjc] [ERROR] Property "Subselect" is already defined. Use &lt;jaxb:property> to resolve this conflict.
[ant:xjc] line 86 of file:/home/steve/projects/hibernate/4.0/hibernate-core/hibernate-core/src/main/resources/org/hibernate/hibernate-mapping-4.0.xsd
[ant:xjc]
[ant:xjc] [ERROR] The following location is relevant to the above error
[ant:xjc] line 307 of file:/home/steve/projects/hibernate/4.0/hibernate-core/hibernate-core/src/main/resources/org/hibernate/hibernate-mapping-4.0.xsd
[ant:xjc]
Why?
----
Historically, Hibernate relied on standard class-loading paradigms that targeted JSE and JEE deployment environments. However, with the growth of OSGi and other modular systems those same approaches no longer always work. So Hibernate needed a new approach that would allow it operate in all possible deployment environments.
How?
----
In Hibernate 4 we leverage the ServiceRegsitry to define a pluggable service for providing interaction with the class-loading of the semantics of the environment in which Hibernate will be run. Specifically, the idea is to allow external entities (the user, the environment developers, etc) to define and "plug in" a custom scheme for class path interactions. For example, an OSGi container could choose to provide Hibernate (either directly or as its JPA provider) and install a custom service for class loader interactions to override the default one.
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2010, 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
// Initial prototype/sandbox for notion of "orchestrated information collection from sources" ~~~~~~~~~~~~~~~~~~~~~~
private static enum SimpleAttributeNature { BASIC, MANY_TO_ONE, ONE_TO_ONE, ANY };
private interface SimpleAttributeSource {
public String getName();
public ExplicitHibernateTypeSource getTypeInformation();
public String getPropertyAccessorName();
public boolean isInsertable();
public boolean isUpdatable();
class EntityBinding ... {
...
private Map<String, AttributeBinding> attributeBindingMap = new HashMap<String, AttributeBinding>();
...
public Iterable<AttributeBinding> getSubclassAttributeClosure() {
List<AttributeBinding> closure = new ArrayList<AttributeBinding>();
EntityBinding entityBinding = this;
while ( entityBinding != null ) {
entityBinding.collectAttributeBindings( closure );
entityBinding = entityBinding.superEntityBinding;
public void beforeCompletion() {
LOG.trace("Transaction before completion callback");
boolean flush;
try {
final int status = transactionCoordinator
.getTransactionContext()
.getTransactionEnvironment()
.getJtaPlatform()
.getCurrentStatus();