joined-subclass

Avoiding outer joins across tables when using joined inheritance with Spring Data JPA

浪尽此生 提交于 2019-12-19 03:12:43
问题 Consider the following classes in a Spring Data JPA (+ Hibernate) application: @Entity @Inheritance(strategy = InheritanceType.JOINED) @Table(name = "person") public class Person { } @Entity @Table(name = "customer") public class Customer extends Person { } @Entity @Table(name = "employee") public class Employee extends Person { } @Entity @Table(name = "manager") public class Manager extends Employee { } public interface IPersonRepository extends JpaRepository<Person, Long> { } public

Java Subclass $

非 Y 不嫁゛ 提交于 2019-12-13 04:12:19
问题 I am new to Java and might be asking a basic question which might sound silly to some. After I compile my Main Java class most of the subclasses are displayed as $ in the folder. I copy the complied classes and put it on another location to execute. Everytime I make make a change to the main class or one of the sub classes do I need to copy all the associated subclasses? or just copying the changed ones will do? Thanks. Nick 回答1: Is this about subclassing ( class Y extends X {} ), or nested

jpa how to create new entity with same id as parent entity (JOINED Inheritance)

血红的双手。 提交于 2019-12-11 05:53:19
问题 my question is very similar to Changing the type of an entity preserving its ID, but instead i´m using InheritanceType.JOINED instead of Table_per_class. This means i don´t to change any table, just to create a new subclass, with the same id as the superclass. To summarize, I have a Person class and a Doctor, which extends Person and has the same id of it. I need to retrieve a Person from the database and make it a Doctor, preserving all the data from the Person entity, but creating some

NHibernate Caching Objects Based on Parent Class's ID

痞子三分冷 提交于 2019-12-11 05:32:55
问题 I have the following definitions for the Animal and Dog types. Note that the ID for the object is the AnimalID: <class name="Animal" table="Animals"> <id name="Id" type="System.Int32" column="AnimalID"> <generator class="identity" /> </id> <property name="IsBig" column="IsBig" type="System.Bool" not-null="true" /> </class> <joined-subclass name="Dog" table="Dogs" extends="Animal"> <key column="AnimalID" /> <property name="OwnerID" column="OwnerID" type="System.Int32" non-null="true" />

how to map a one-to-many collection to a joined subclass when key is in the parent class

三世轮回 提交于 2019-12-10 10:48:36
问题 I'd like to map a one to many collection to a subclass but the key of the collection is an attribute of the parent class. Currently i'm mapping AbstractFoo Foo and Bar class like this : <class name="AbstractFoo" abstract="true" table="abstractFoo"> <id name="_id" column="foo_pk"> <generator class="native" /> </id> <many-to-one name="_bar" column="bar_fk"> </many-to-one> <joined-subclass name="Foo" table="foo"> <key column="abstractFoo_fk" /> <property name="_type" column="type" /> </joined

Play Framework 2 Ebean and InheritanceType as JOINED

。_饼干妹妹 提交于 2019-12-08 16:35:31
问题 After some research on Google, I haven't found anyone who has my problem that's why I'm posting it here. In my application I have three entities : User (abstract), Customer, Agency. Customer and Agency extends User. Here is the code of User : @Entity @Inheritance(strategy = InheritanceType.JOINED) public abstract class User extends AbstractModel { @Column(unique = true) @NotNull @Email public String email; @NotNull public String password; } The problem is that the generated schema creates

how to map a one-to-many collection to a joined subclass when key is in the parent class

Deadly 提交于 2019-12-06 09:31:41
I'd like to map a one to many collection to a subclass but the key of the collection is an attribute of the parent class. Currently i'm mapping AbstractFoo Foo and Bar class like this : <class name="AbstractFoo" abstract="true" table="abstractFoo"> <id name="_id" column="foo_pk"> <generator class="native" /> </id> <many-to-one name="_bar" column="bar_fk"> </many-to-one> <joined-subclass name="Foo" table="foo"> <key column="abstractFoo_fk" /> <property name="_type" column="type" /> </joined-subclass> </class> <class name="Bar" table="bar"> <map name="_foos" inverse="true"> <key column="bar_fk"/