Questions tagged [many-to-one]
1040 questions
0
votes
1 answer
Windows Phone 7.1 - Many-To-One relation on the same table - DB
I'm trying to create a DB that has a Many-To-One relation between an object to itself.
(I have a user and the user should have a list of other users that he knows...)
I have 2 questions:
I know that in order to do a Many-To-One relation between…

nati
- 91
- 2
- 8
0
votes
2 answers
CakePHP to save relationship in other model
I have these models:
class Prefix extends AppModel {
public $displayField = 'prefix';
public $hasMany = array(
'State' => array(
'className' => 'State',
'foreignKey' => 'prefix_id',
'dependent' =>…

Lanbo
- 15,118
- 16
- 70
- 147
0
votes
0 answers
JPA ManyToOne relations from different entities to the same entity
I have different entities in my model and more than one needs an Address, is there any way to do this without having tables with duplicate information?
E.g. a model that has a User and an EnglishClass entity, both need an Address with same data, as…

Molly
- 297
- 1
- 5
- 16
0
votes
4 answers
NHibernate: mapping single column from many-to-one to a primitive type
I have a following mapping:
…

Andrey Shchekin
- 21,101
- 19
- 94
- 162
0
votes
0 answers
Program asking for ID while inserting an object in database using Hibernate
I'm trying to save an item in the database which has manytoone relation with the Librarian(which is a subclass of user). The code below creates a table *librarian_item* which has librarian_id and item_id as attributes. When I try to save the data,…

h-rai
- 3,636
- 6
- 52
- 76
0
votes
0 answers
SOAP object returns null
I'm having some simple objects that have relationships with each other. Everything goes fine but when i publish my objects for a SOAP request it is returning null when i set a relation between client and cartrack. What am i doing wrong?
Here is my…

user2281918
- 33
- 3
0
votes
0 answers
what hibernate parameters should i use?
I have a table DEVICE which has a unique id of DEVICEID. I have a second table called DEVICEINFO whose primary key is a sequence DEVICEINFOSEQ but this info table also has a DEVICEID field which is a foreign key pointing back to DEVICE. In the…

p0tta
- 1,461
- 6
- 28
- 49
0
votes
1 answer
NHibernate many-to-one loading alternative
I have a Parent/Child object/mapping as follows:
class Parent {
int Id;
string name;
List children;
}
class Child {
…

chiplip
- 13
- 1
- 5
0
votes
1 answer
Many-to-One w/ Composite key- Foreign key must have same number of columns as he referenced PK
Problem Summary
I am trying to map a many-to-one with a composite key. So far I haven't been able to locate another question that helps. I know how to map to a composite key with one-to-one, but it is not allowing me to map many-to-one.
Below you…

zach
- 1,281
- 7
- 27
- 41
0
votes
1 answer
openerp 7 one2many and many2one
please refer below code lines between 205 - 280
https://github.com/priyankahdp/openerp/blob/openerp/model%20class
and in my view xml lines between 255 - 337
https://github.com/priyankahdp/openerp/blob/openerp/view.xml
and need to clarify where is my…

Anne Mary
- 319
- 2
- 4
- 17
0
votes
1 answer
symfony2 entity oneToMany and methods
Hi i had fully successfully setted my entity onetoMany and ManyToOne i generated setters and getters and in user entity it created this method:
user entity:
/**
* @ORM\OneToMany(targetEntity="TB\RequestsBundle\Entity\Requests",…

Lukas Lukac
- 7,766
- 10
- 65
- 75
0
votes
1 answer
JSF2.0, JPA: How to set list element (mapped in @OneToMany)
I'm looking for good practices and clean solution to my problem.
There are 2 entity classes:
@Entity
public class Site implements Serializable {
...
@OneToMany(mappedBy = "site")
private List siteIpList;
...
public List…

user1987281
- 63
- 6
0
votes
1 answer
Symfony 2 - ManyToOne Bidirectional relationship behaviour
I had a big time trying to figure out how to setup a ManyToOne -> OneToMany relationship with Doctrine 2 and it still not working...
Here is the application behaviour:
A site has Pages
A User can write Comment on a Page
Here are my Entities…

maxwell2022
- 2,818
- 5
- 41
- 60
0
votes
2 answers
Hibernate: Child table having two different ManyToOne relationships
In the Spring/Hibernate/Java/Tomcat app I'm writing I have a OneToMany relationship between an Organization and its Contacts.
Organization 1:M Contact (has foreign key org_id)
In Organization I have this…

Jerome P Mrozak
- 1,907
- 4
- 21
- 33
0
votes
2 answers
@ManyToOne, @OneToMany delete error
Author class:
@Id
@GeneratedValue(
strategy = GenerationType.AUTO)
private int id;
private String firstName;
private String lastName;
@OneToMany(
mappedBy = "author")
private List bookList;
Book class:
@Id
@GeneratedValue(
…

user123454321
- 1,028
- 8
- 26