many-to-one

ManyToOne reference with encrypted fields gives doesn't exist error using Jasypt

I have a problem on the following situation: In my Spring, Hibernate application I got a User Entity and a UserCategory Entity. The table of the user entity got a username as identifier. This indentifierfield can't be encrypted because this table is also used by an older program without the possibility to do this. To make a ManyToOne...

How to handle JPA Many-to-One Relation?

Hi, I am designing an application for collecting weather data. I have 2 POJO objects "Location" and "Record". Location contains information about latitude and longitude and the current weather conditions, and Record contains all the weather information over time for a specific location thus having a Many-to-one relation with Location. T...

hibernate ManyToOne why 2 queries are generated instead of one?

hi, MyTable is a table in my Oracle DB, it has a CMP_ID to join the COMPANIES table. Here is the Java implementation : public class MyTable implements Serializable { ... @ManyToOne(fetch = FetchType.LAZY) @JoinColumns( { @JoinColumn(name = "CMP_ID", referencedColumnName = "CMP_ID", nullable = false) }) @XmlTransient Company company; ....

how do i automap an many-to-one relationship using fluent nhibernate

i have the following class: public class Worker { public int WorkerID {get;set;} public string Name { get;set;} } public class TransferOrder { public int TransferOrderID { get;set;} public Worker workerTobeTransfered{get;set;} } how do i automap this classes in fluent nhibernate. ...

in fluent-nhibernate,saving a many-to-one entity, why i should give a version to the referenced entity.

i have the following entities: public class Worker { public int WorkerID {get;set;} public string Name { get;set;} public int version { get;set;} } public class TransferOrder { public int TransferOrderID { get;set;} public Worker workerTobeTransfered{get;set;} public int version { get;set;} } and i am using the Auto mapp...

NHibernate: Composite key many-to-one mapping: Can't resolve property (foreign key component)

Hi guys, I hope anyone can help. I have to develop up against this third party database and I am kind of stuck with their crappy design. Still, I want to use NHibernate so I will have to jump through hoops. Simplified, there is this "Event" table that has a relation a "Transportation" table. The transportation table has a composite p...

Hibernate LazyInitializationException: failed to lazily initialize a collection of role

I have a web service which is essentially a wrapper for a DAO. I am calling the web service/DAO to request a collection of entities. The "parent" entity class contains a collection of "child" entity objects, i.e. a one-to-many relationship. The DAO method call which fetches the "parent" entity collection (i.e. myDAO.findAll()) retur...

Hibernate many-to-one relationship delete not working as expected

Hi I have 3 tables as following 1) User has userId 2) UserProductEntitlement has userId and productId and a boolean 3) Product has productId This is my class representation : @Table(name="User") class User { @OneToMany(fetch=FetchType.EAGER, targetEntity = ProductEntitlement.class, cascade=CascadeType.ALL) @JoinColumn(nam...

Need help with a good design for many to one relationships with XML serialization in C#

Assuming I have some data in the form of Customer1 Name Address Order1 ID Products Product1 ID Product2 ID Customer2 ... Using the following class to represent it class Customer { public String name { get; set; } public String Address {get; set;} public List<OrderInfo> Orders { get; set; } } class Order { ...

nhibernate: many-to-one using multiple columns

So I have scavenged the internet for a while now and am still stumped on this current issue I am facing with nHibernate: I have two tables that I have mapping files for. Table A stores information about "Things", and Table B stores how these "Things" are related. The problem is as follows. Table A is mapped to the Thing class. Table B n...