Questions tagged [many-to-one]
1040 questions
0
votes
1 answer
Issue with fetching data in a One to Many relationship in JPA
I tried to make the question smaller, but I could not make it smaller :(
I have 2 entities and this is how they are related:
Collection (1) ----> (n) Item
Item (0 or 1) -----> (n) Item
i.e. each Item is related to a Collection. Further each Item…

TJ-
- 14,085
- 12
- 59
- 90
0
votes
1 answer
Is this cardinality many-to-many or many-to-one?
I'm about to setup a bunch of databases but I'm stuck at the moment.
There is a table of multible schools [school] that teach subjects [subject].
Each school teaches one subject or more than one subject. The subjects don't know about the schools.
I…

Lama
- 2,886
- 6
- 43
- 59
0
votes
1 answer
ManyToOne join in symfony2
For a game I have 2 entities: story and story_completed. Story is same for all users(here company), and story_completed indicates which user have seen/completed which story. Now I would like to show a list of stories for an user and show which are…

degressor
- 358
- 4
- 16
0
votes
1 answer
Doctrine2: first OneToMany relationship works, second doesn't?
I have a class that contains two OneToMany relationships.
Here is the sql squema
and here are the different classes.
Movies
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity
*…

ieeehh
- 674
- 5
- 10
0
votes
1 answer
django one-to-many
Long story short: I have two models, and a database imported from XML. The model layout is as follows:
class A:
ForgeinKey(B)
class B:
list = {A1, A2 ... An}
Is there a replacement for {A1, A2 ... An} that would make B.list return a list…

Juho
- 21
- 1
- 3
0
votes
1 answer
Force Hibernate to delete joining table rows
I am a bit confused as I can't force Hibernate to remove the rows in the joining table. Probably I need to configure something differently.
I have a table Component and Task and a table the connects them Component_Tasks. In my class Component I…

Boris Horvat
- 563
- 2
- 13
- 28
0
votes
1 answer
How do I make JPA entity manager forget about previous exceptions?
I'm using Hibernate 4.1.0.Final and hibernate-jpa-2.0-api. I'm having a problem whereby once I save an entity that contains an error, repeated saves on other entities give me the same error as what was reported for the first entity, even when the…

Dave
- 15,639
- 133
- 442
- 830
0
votes
2 answers
Many-to-one unidirectional relation in DataNucleus
For the context, client-side I use the MVP pattern, so the view with the One list knows only the ID, and when my new Many is received on the server, I want to be able to just update the One's foreign key, with a "setOneId" or an empty One object…

Malexandre
- 215
- 2
- 8
0
votes
1 answer
Hibernate 4: Partial many-to-one association + where/filter discriminator
I'm using Hibernate 4. I have this database with Category and CategoryItem tables:
CREATE TABLE `test`.`Category` (
`Id` INT NOT NULL AUTO_INCREMENT ,
`Description` VARCHAR(50) NOT NULL ,
PRIMARY KEY (`Id`) )
CREATE TABLE…

vladiastudillo
- 407
- 1
- 10
- 23
0
votes
1 answer
doctrine2 one-to-many not working
This is a simple problem, but after going through all similar threads in Stackoverflow and elsewhere without success, the problem remains.
I can't get bidirectional One-To-Many relationship working. Biomass.field is accessible (owning side), but…

Kristo Aun
- 526
- 7
- 18
0
votes
1 answer
OpenJPA + Derby ManyToOne issue after update OpenJPA from 1.2 to 2.2
I just updated OpenJPA from version 1.2 to 2.2 and many of my JUnits failed. Most of them because ManyToOne relation changed behavior. Lets say we have two entities
package org.my;
import javax.persistence.Entity;
import…

Maciej Laskowski
- 697
- 1
- 5
- 7
0
votes
2 answers
how to flatten a model with NHibernate
Say I have three tables Products, Languages and ProductTranslations that look like the following:
(1) ProductId
(1) StandardName
(1) Price
(2) LanguageId
(2) LanguageName
and
(3) ProductTranslationId
(3) ProductId
(3) LanguageId
(3) …

Kerry
- 143
- 9
0
votes
1 answer
Nhiibernate many-to-one delete parent entity
i have 2 classes
public class Message : IMessage
{
public virtual int Ik { get; private set; }
public virtual string Description { get; set; }
}
public class Action
{
public virtual int Ik { get; set; }
…

user681055
- 59
- 11
0
votes
1 answer
how to get one side object value when query many side?
I use play framework to do web sample excise and meet a problem related to manyToOne.
My object relationship is as follow:
@Entity
@Table(name="account")
public class User extends Model{
@Id
@Constraints.Required
…

kaiven
- 11
- 2
0
votes
1 answer
Should I choose many-to-many instead many-to-one to avoid changing old common entities?
Example first to make my question clear:
Tested old entity in Common Project: Posology entity (fields: unit, nuberperintake)
Entity in new Project: PatientMedication(fields: drugId, patientId)
PatientMedication may have multiple Posologies for a…

user1532146
- 184
- 2
- 14