one-to-many

What is wrong in my nested SUBQUERY predicate?

纵饮孤独 提交于 2019-12-30 06:38:05
问题 I have the data model you can see below, and a nested SUBQUERY predicate, but in somehow it just not works. Any idea how to correct it? I figured out, this here down is working finally: [NSPredicate predicateWithFormat:@"SUBQUERY(bs, $B, SUBQUERY($B.cs, $C, $C.ds.name != \"xxx\").@count > 0).@count > 0"]; 回答1: Ok, so here is the working solution: [NSPredicate predicateWithFormat:@"SUBQUERY(bs, $B, SUBQUERY($B.cs, $C, $C.ds.name != \"xxx\").@count > 0).@count > 0"]; 来源: https://stackoverflow

ids for this class must be manually assigned before calling save()

淺唱寂寞╮ 提交于 2019-12-30 04:41:06
问题 I've got some problem with hibernate @OneToMany mapping. It goes like here @Entity @Table(name = "albums") @SequenceGenerator(name = "ALBUMS_SEQ", sequenceName = "albums_seq", allocationSize = 1) public class AlbumDs { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ALBUMS_SEQ") private Integer id; private Integer ownerId; private String name; private String description; private Date created; @OneToMany(cascade = CascadeType.ALL) @JoinColumn(name = "albumId", insertable =

OneToMany - what are the differences between join table and foreign key?

£可爱£侵袭症+ 提交于 2019-12-30 04:29:04
问题 There is the possibility to disable the @OneToMany relationship join table with the @JoinColumn annotation. The default is a join table. What are the advantages and disadvantages for a production system for example? When should I use a join table and when not? Thank you. 回答1: By default @OneToMany will create a join table only if you'll use unidirectional relationship . In other words, if you have Employee and Project entities and the Employee entity is defined as follows (assume there is no

JPA @OneToMany -> Parent - Child Reference (Foreign Key)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-28 08:08:32
问题 i have a Question about referencing ParentEntities from Child Entites ir If i have something like this: Parent.java: @Entity(name ="Parent") public class Parent { @Id @Generate..... @Column private int id; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parent") private Set<Child> children; simple ... getter and setter ... } And the Child.java: @Entity(name ="Child") public class Child{ @Id @Generate.... @Column private int id; @ManyToOne private Parent parent; ...

JPA @OneToMany -> Parent - Child Reference (Foreign Key)

☆樱花仙子☆ 提交于 2019-12-28 08:08:07
问题 i have a Question about referencing ParentEntities from Child Entites ir If i have something like this: Parent.java: @Entity(name ="Parent") public class Parent { @Id @Generate..... @Column private int id; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parent") private Set<Child> children; simple ... getter and setter ... } And the Child.java: @Entity(name ="Child") public class Child{ @Id @Generate.... @Column private int id; @ManyToOne private Parent parent; ...

NHibernate configuration for uni-directional one-to-many relation

橙三吉。 提交于 2019-12-28 02:44:19
问题 I'm trying to set up a relationship as follows. Each Master item has one or more Detail items: public class Detail { public virtual Guid DetailId { get; set; } public virtual string Name { get; set; } } public class Master { public virtual Guid MasterId { get; set; } public virtual string Name { get; set; } public virtual IList<Detail> Details { get; set; } } And Mappings: public class MasterMap : ClassMap<Master> { public MasterMap() { Id(x => x.MasterId); Map(x => x.Name); HasMany(x => x

How to apply @OneToMany on super class getter method in multiple subclasses with different target entity

半城伤御伤魂 提交于 2019-12-25 14:40:25
问题 Stack I'm using JPA2.0 with Eclipselink 2.6.3 and Spring 4(JTA). Problem I'm trying to override the class A attribute with @OneToMany mapping in class B and class C (which is similar to class B ) so that I can change the target entity to class X and Z respectively while fetching results for class B. Class A has SINGLE_TABLE inheritance and class B & C are discriminator classes which is maintained by @classExtractor depending on some field value in class A. Class Z has TABLE_PER_CLASS

How to apply @OneToMany on super class getter method in multiple subclasses with different target entity

百般思念 提交于 2019-12-25 14:40:03
问题 Stack I'm using JPA2.0 with Eclipselink 2.6.3 and Spring 4(JTA). Problem I'm trying to override the class A attribute with @OneToMany mapping in class B and class C (which is similar to class B ) so that I can change the target entity to class X and Z respectively while fetching results for class B. Class A has SINGLE_TABLE inheritance and class B & C are discriminator classes which is maintained by @classExtractor depending on some field value in class A. Class Z has TABLE_PER_CLASS

Joining-Table with Metadata Impairs Getters/Setters - Doctrine 2

我的梦境 提交于 2019-12-25 09:00:24
问题 I'm writing a feature which calls for the records of my joining table to carry extra metadata ( Joining-Table with Metadata ). I've attempted to implement this in accordance with this section of the Doctrine documentation. See below for example Entity definitions. The challenge now is that getGroups and setGroups do not yield/set Group entities (& the same is true from the Group instance perspective), but they yield GroupUser entities. This adds a substantial delay to process of managing this

JPA @JoinColumn one to many bi-directional relationship with a composite key as FK

自作多情 提交于 2019-12-25 08:23:16
问题 I have been scratching my head over this for weeks now and I have no idea how to work my way around it. I have two tables: Author (author_code, author_number, author_name) author_code and author_number are primary keys Title (author_code, title_code, sequence, title_desc) title_code and sequence are primary keys Code: @Entity @IdClass(AuthorPK.class) @Table(name="Author") public class Author implements Serializable { @Id @Column(name="author_code") private long authorCode; @Id @Column(name=