hibernate identifiers examples (#2977)

* hibernate identifiers examples

* fix conflict

* change to longstream

* change to format
This commit is contained in:
Loredana Crusoveanu
2017-11-10 13:33:52 +02:00
committed by Grzegorz Piwowarek
parent cfd3def015
commit c9aaa0d993
12 changed files with 414 additions and 0 deletions

View File

@@ -2,8 +2,17 @@ package com.baeldung.hibernate;
import com.baeldung.hibernate.pojo.Employee;
import com.baeldung.hibernate.pojo.EntityDescription;
import com.baeldung.hibernate.pojo.OrderEntry;
import com.baeldung.hibernate.pojo.OrderEntryIdClass;
import com.baeldung.hibernate.pojo.OrderEntryPK;
import com.baeldung.hibernate.pojo.Product;
import com.baeldung.hibernate.pojo.Phone;
import com.baeldung.hibernate.pojo.TemporalValues;
import com.baeldung.hibernate.pojo.Course;
import com.baeldung.hibernate.pojo.Student;
import com.baeldung.hibernate.pojo.User;
import com.baeldung.hibernate.pojo.UserProfile;
import org.hibernate.SessionFactory;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
@@ -33,6 +42,14 @@ public class HibernateUtil {
metadataSources.addAnnotatedClass(Phone.class);
metadataSources.addAnnotatedClass(EntityDescription.class);
metadataSources.addAnnotatedClass(TemporalValues.class);
metadataSources.addAnnotatedClass(User.class);
metadataSources.addAnnotatedClass(Student.class);
metadataSources.addAnnotatedClass(Course.class);
metadataSources.addAnnotatedClass(Product.class);
metadataSources.addAnnotatedClass(OrderEntryPK.class);
metadataSources.addAnnotatedClass(OrderEntry.class);
metadataSources.addAnnotatedClass(OrderEntryIdClass.class);
metadataSources.addAnnotatedClass(UserProfile.class);
Metadata metadata = metadataSources.buildMetadata();
return metadata.getSessionFactoryBuilder()