Skip to content

Instantly share code, notes, and snippets.

View stliu's full-sized avatar

Strong Liu(刘少壮) stliu

View GitHub Profile
select
human0_.mammal as id1_0_0_,
human2_.mammal as id1_0_1_,
human0_2_.description as descript2_0_0_,
human0_2_.body_weight as body_wei3_0_0_,
human0_2_.mother_id as mother_i4_0_0_,
human0_2_.father_id as father_i5_0_0_,
human0_2_.zoo_id as zoo_id6_0_0_,
human0_2_.serialNumber as serialNu7_0_0_,
@stliu
stliu / gist:7086002
Last active December 26, 2015 03:29
Employee{
	@OneToMany
	Set<Employee> children;
	@ManyToOne
	Address address;
}

EntityGraph(Employee)
	|

---- AttributeNode(children) - SubGraph(Employee)

[weli@virt-jboss-01 ~]$ sudo virsh list
 Id    Name                           State
----------------------------------------------------
 1     VM_weli                        running
 4     stliu                          running
 6     jimma                          running
 8     lgao                           running

Service Registry

People who has upgraded to Hibernate ORM 4.x may noticed that the well know way to build SessionFactory (see blow) now is deprecated.

Configuration configuration = new Configuration(); SessionFactory sf = configuration.buildSessionFactory();

The recommended way is

org.hibernate.cfg.Configuration#buildSessionFactory(ServiceRegistry serviceRegistry) 
------------------------ LOAD PLAN BRANCH
select
file0_.filename as filename1_16_0_,
file0_.parent_filename as parent2_16_0_,
file0_2_.xsize as xsize1_9_0_,
file0_3_.target_filename as target2_15_0_,
case
when file0_1_.filename is not null then 1
when file0_2_.filename is not null then 2
org.hibernate.cfg.OneToOneSecondPass#doSecondPass
if ( !optional ) value.setConstrained( true );
value.setForeignKeyType(
value.isConstrained() ?
ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT :
ForeignKeyDirection.FOREIGN_KEY_TO_PARENT
);
select
customer0_.id as id1_1_3_,
customer0_.customerNumber as customer2_1_3_,
customer0_.lastOrder_id as lastOrde4_1_3_,
customer0_.name as name3_1_3_,
order1_.id as id1_0_0_,
order1_.country_id as country_4_0_0_,
order1_.deliveryDate as delivery2_0_0_,
order1_.orderNumber as orderNum3_0_0_,
country2_.id as id1_4_1_,
package org.hibernate.metamodel.internal.source.annotations.attribute;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.classmate.MemberResolver;
import com.fasterxml.classmate.ResolvedType;
import com.fasterxml.classmate.ResolvedTypeWithMembers;
import com.fasterxml.classmate.TypeResolver;
Test classes have no parent class:
org.hibernate.cache.spi.NaturalIdCacheKeyTest
org.hibernate.metamodel.source.annotations.xml.mocker.AbstractMockerTest
org.hibernate.test.annotations.access.jpa.AccessMappingTest
org.hibernate.test.annotations.configuration.ConfigurationTest
org.hibernate.test.annotations.ConfigurationTest
org.hibernate.test.annotations.duplicatedgenerator.DuplicateTest
org.hibernate.test.annotations.fkcircularity.FkCircularityTest
org.hibernate.test.annotations.namingstrategy.NamingStrategyTest
------------------------------------------------------------------------
r20996 | stliu | 2011-12-14 11:02:55 +0800 (Wed, 14 Dec 2011) | 1 line
upgrade to 3.4.0.CP05
------------------------------------------------------------------------
r20993 | alessandrolt | 2011-11-19 03:00:04 +0800 (Sat, 19 Nov 2011) | 1 line
JBPAPP-7488 - including testJarVisitorFactory() to JarVisitorTest Test Case. This test asserts the correct return of JarVisitorFactory.getVisitor
------------------------------------------------------------------------
r20992 | alessandrolt | 2011-11-19 02:59:19 +0800 (Sat, 19 Nov 2011) | 1 line