hierarchy « Update « JPA Q&A





1. Is it bad practice to use DiscriminatorFormula for migration of Hibernate databases?    stackoverflow.com

I have an application using Hibernate for data persistence, with Spring on top (for good measure). Until recently, there was one persistent class in the application, A:

@Entity
public class A {
 ...

2. DiscriminatorFormula    stackoverflow.com

If I have a single table where I need multiple columns for discriminator, is my only solution to use a @DiscriminatorFormula? I ask because some prototyping gave us some results that I ...

3. hibernate saving multiple hierarchy records    coderanch.com

I have mapping like - User has many Order Order has many OrderItem OrderItem has one Address. When a user make order - I have to save User, Order, OrderItem, Address in database. In my DAO, I am saving record for Order as getSession().save(OrderData); I have to further save Orderitem and Addresses. Please guide me how do I do save records ...

4. Depth of the hierarchy to be saved    forum.hibernate.org

Is there any way I can tell hibernate to go ahead and save only "n" level deep? What i mean is that lets say we have an item (parent class), which has fields and a field can be a list (of items). So can i tell to go to a specific level for saving?

5. Not persisting data more than 2 levels of hierarchy    forum.hibernate.org

I have 3 levels of classes a) @MappedSuperclass public abstract class CmpntObject implements Comparable, Serializable { @Column(name = "enabled") private Boolean enabled = Boolean.TRUE; } b)@Entity @Table(name = "asmnt_item", schema = "public") @DiscriminatorColumn(name = "question_type_enum", discriminatorType = DiscriminatorType.STRING) public abstract class Item extends CmpntObject implements Comparable { @Column(name = "valid") private Boolean valid = Boolean.TRUE; other columns.. } c) @Entity @DiscriminatorValue(value ...

6. Persisting Class conversions in a Class Hierarchy    forum.hibernate.org

Say I have a Class hierarchy, where Parent and Child both extend Person. I have the mapping set up so that the whole hierarchy persists to one table, called Person. I persist an instance of Person to the table. At some point I obtain further information about this particular Person, and so now want to convert to the Parent class and ...

7. Problem with bulk update and hierarchy    forum.hibernate.org

I have a problem when i try to make an update using hibernate My project has the structure of a single parent class, and all the others class extending from the parent. When i try to update a field in a subclass table i get the exception: Code: 16:22:45,140 INFO [STDOUT] org.hibernate.HibernateException: no table name defined for insert-select ...

8. update of table per hierarchy    forum.hibernate.org

@javax.persistence.Entity(name="Card") @javax.persistence.Table(name="Card") @javax.persistence.DiscriminatorColumn(name="type") @javax.persistence.Inheritance(strategy=InheritanceType.SINGLE_TABLE) public class Card { @javax.persistence.Id Integer id; @javax.persistence.Basic String type; @javax.perisistence.Basic Integer status; } @javax.persistence.Entity(name="PhyCard") @javax.persistence.DiscriminatorValue("Phycard") @javax.persistence.SecondaryTable{name="PhyCard", pkJoinColumns={@javax.persistence.PrimaryKeyJoinColumn(name="id")} ) public class PhyCard extends Card { @javax.persistence.Basic Integer bw; }