@@ -0,0 +1,3057 @@
+package com.vladmihalcea.hibernate.masterclass.laboratory.mapping;%0A%0Aimport com.vladmihalcea.hibernate.masterclass.laboratory.util.AbstractTest;%0Aimport org.hibernate.annotations.DynamicUpdate;%0Aimport org.hibernate.annotations.Immutable;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport javax.persistence.*;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A%0A/**%0A * OneTableMultipleEntitiesTest - Test to check the one table multiple entities%0A *%0A * @author Vlad Mihalcea%0A */%0Apublic class OneTableMultipleEntitiesTest extends AbstractTest %7B%0A%0A    @Override%0A    protected Class%3C?%3E%5B%5D entities() %7B%0A        return new Class%3C?%3E%5B%5D%7B%0A                Post.class,%0A                PostSummary.class,%0A                UpdatablePostSummary.class%0A        %7D;%0A    %7D%0A%0A    @Before%0A    public void init() %7B%0A        super.init();%0A        doInTransaction(session -%3E %7B%0A            Post post = new Post();%0A            post.setName(%22Hibernate Master Class%22);%0A            post.setDescription(%22Hibernate Master Class Description%22);%0A            session.persist(post);%0A        %7D);%0A    %7D%0A%0A    @Test%0A    public void testOneTableMultipleEntities() %7B%0A        doInTransaction(session -%3E %7B%0A            Post post = (Post) session.get(Post.class, 1L);%0A            PostSummary postSummary = (PostSummary) session.get(PostSummary.class, 1L);%0A            UpdatablePostSummary updatablePostSummary = (UpdatablePostSummary) session.get(UpdatablePostSummary.class, 1L);%0A            assertEquals(post.getName(), postSummary.getName());%0A            assertEquals(post.getName(), updatablePostSummary.getName());%0A            updatablePostSummary.setName(%22Hibernate Master Class Tutorial.%22);%0A        %7D);%0A    %7D%0A%0A    @Entity(name = %22Post%22)%0A    public static class Post %7B%0A%0A        @Id%0A        @GeneratedValue(strategy=GenerationType.AUTO)%0A        private Long id;%0A%0A        private String name;%0A%0A        private String description;%0A%0A        public String getName() %7B%0A            return name;%0A        %7D%0A%0A        public void setName(String name) %7B%0A            this.name = name;%0A        %7D%0A%0A        public String getDescription() %7B%0A            return description;%0A        %7D%0A%0A        public void setDescription(String description) %7B%0A            this.description = description;%0A        %7D%0A    %7D%0A%0A    @Entity(name = %22PostSummary%22)%0A    @Table(name = %22Post%22)%0A    @Immutable%0A    public static class PostSummary %7B%0A%0A        @Id%0A        @GeneratedValue(strategy = GenerationType.AUTO)%0A        private Long id;%0A%0A        private String name;%0A%0A        public String getName() %7B%0A            return name;%0A        %7D%0A%0A        public void setName(String name) %7B%0A            this.name = name;%0A        %7D%0A    %7D%0A%0A    @Entity(name = %22UpdatablePostSummary%22)%0A    @Table(name = %22Post%22)%0A    @DynamicUpdate%0A    public static class UpdatablePostSummary %7B%0A%0A        @Id%0A        @GeneratedValue(strategy = GenerationType.AUTO)%0A        private Long id;%0A%0A        private String name;%0A%0A        public String getName() %7B%0A            return name;%0A        %7D%0A%0A        public void setName(String name) %7B%0A            this.name = name;%0A        %7D%0A    %7D%0A%0A%7D%0A

Add test for one table two entities