Questions tagged [nhibernate-inheritance]

9 questions
2
votes
1 answer

NHibernate JOIN mapping fails when the mapped field is moved to a base class

Having two model classes with many common fields, I decided to create a base class and both of them to inherit from it. The existent model classes already came with map classes. All the common fields which are now inherited in the child classes…
2
votes
1 answer

Hibernate Inheritance. super class attributes

I need to map a class to which I have no access. @Entity public class User extends org.springframework.security.core.userdetails.User { @Id @GeneratedValue private Integer id; private Integer age; ... } My tables are…
xedo
  • 1,117
  • 3
  • 18
  • 34
1
vote
0 answers

parent always inserts instead of update with InheritanceType.JOINED

I am facing issue while saving a parent entity with inheritance if it already exists. I have an entities as below, @Entity @PrimaryKeyJoinColumn(name = "CHILD_ID") public class ChildEntity extends ParentEntity { @Column(name = "NAME") private…
Vikas
  • 6,868
  • 4
  • 27
  • 41
1
vote
0 answers

How to disable delete cascading for JPA joined inheriting Entity?

I have three entities. Both ResolvedCorpus and UnqualifiedCorpus are subclasses of Corpus to help model and address certain concerns for some Corpus. Joined inheritance type is selected for data persistence via JPA. The entities are defined as…
0
votes
0 answers

Hibernate and Inheritance - need to add one additional column (Spring Boot)

I have table A: @Entity @Table(name = "A") public class A{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(nullable = false, updatable = false) private Long id; @ManyToOne(fetch = FetchType.EAGER) …
Matley
  • 1,953
  • 4
  • 35
  • 73
0
votes
1 answer

"Error executing multi criteria" exception when using subclasses in NHibernate

I'm trying to map the following classes to the following tables using NH: public abstract class Person { public string SSN { get; set; } public string FirstName { get; set; } public string LastName { get; set; } } public class Customer…
0
votes
2 answers

Unusual NHibernate collection/inheritance mapping

Here are my relevant classes: public class ArticleMetadata { public long ID { get; set; } public string Slug { get; set; } } public class Article : ArticleMetadata { // This is a massive CLOB, hence separate class public string…
Anton Gogolev
  • 113,561
  • 39
  • 200
  • 288
0
votes
1 answer

HQL Update issue

I have two entities. Data_mart and entity_data. entity_data extends data_mart. I have id column in both the data_mart and entity_data. data_id in entity mart is the foregin key of the data_mart(Pkey over there is id). @Entity @Table(name =…
Harikrishnan Ck
  • 920
  • 1
  • 11
  • 12
0
votes
1 answer

Hibernate inheritance implementation issue

I want to write one hbm file. My class hierarchy is BaseClassOne{ private long id; ...getters and setters.... } ClassA extends BaseClassOne{ other private members; ...getters and setters.... } classB extends BaseClassOne{ other private…
JOHND
  • 2,597
  • 6
  • 27
  • 35