row « Map « JPA Q&A





1. Why is hibernate deleting rows from join table when adding element to set mapping many-to-many?    stackoverflow.com

Suposse I have two classes:

class A {
Set<B> bs
}
class B {
}
This mapping:
<set name="bs" table="bs_tab" cascade = "save-update">
            <key column="a_id />
  ...

2. JPA2: How to map only certain table rows to an entity?    stackoverflow.com

I have a table I cannot change with approximately this structure

ID, name, purpose, rubbish...
1, foo, PRICING, ...
2, bar, INVENTORY, ...
3, bar, PRICING, ...
What is the preferred way to map only the ...

3. Why does Hibernate insert a parent row with a foreign key without inserting the child row?    stackoverflow.com

I'm hoping someone has run into this problem before and can help me out. Basically, Hibernate is inserting a parent row (with an ID pointing to a child row), but not ...

6. Cannot add or update a child row    forum.hibernate.org

Newbie Joined: Tue Mar 16, 2010 1:13 pm Posts: 1 Hi all. I have the following code: Code: @Entity @Table(name = "users", uniqueConstraints = @UniqueConstraint(columnNames = { "username" })) public class User extends BaseEntity { @Column(name = "username", length = 50, nullable = false) private String username; @Column(name = ...

7. Cannot addorupdate a child row:a foreign key constraintfails    forum.hibernate.org

Newbie Joined: Wed Mar 31, 2010 4:35 am Posts: 19 I have two tables xydataa and fm4featuress this is my application Xytaaa.hbm.xml

8. Repeated rows in manytoone relationship    forum.hibernate.org

I have a problem I got a repeated rows in the parent entity as much as I insert a child in the database (e.g. if I insert 3 child to the same parent i got the parent repeated 3 times in the list returns from database) I use InheritanceType = TABLE_PER_CLASS. the Enterprise entity Code: @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract ...





10. Map only rows that match a condition    forum.hibernate.org

11. Multiple objects to single row mapping    forum.hibernate.org

Can Gavin, or any one of you, kind ladies and gentleman explain once and for all how to deal with this (SEE TOPIC NAME). Most of us work in the environment where SQL queries are complex and database schema already exists. So we have to work backwards, creating domain model from existing schema. This is awkward but such is life. Many ...

12. Mapping Classes for grouping rows    forum.hibernate.org

I have a table (REPORT) which contains 3 columns: GROUP REPORT_NAME CLASS PROCESS All of these are part of the primary key. I would like to create an object model such that a GROUP object contains a collection of REPORT objects, each of which has a name, class and process as properties. Is this possible to do in hibernate, given that ...

13. map problem: SQL insert, update or delete failed (row not fo    forum.hibernate.org

Hi, I have a Master - Detail relationship, where there are many different types of details (necessitating specialization). The Master points forward to its Details (I'd like to keep it that way - bidirectionality isn't an option). I need to associate some identifier with each detail record, and store it in the Master - which is naturally a map. The problem ...

14. many-to-many mapping inserting duplicate rows    forum.hibernate.org

First off I'd like to apologise if this question has been answered elsewhere. I've looked on the forums but nothing doing. I am trying a prototype out which has a many-to-many relationship. I have two tables Roles and Principals and a join table role_principals. My mapping is as follows:

16. Duplicate rows returned with one-to-one mapping    forum.hibernate.org

Page 1 of 1 [ 5 posts ] Previous topic | Next topic Author Message todd_farmer Post subject: Duplicate rows returned with one-to-one mapping Posted: Wed Jan 26, 2005 3:19 am Newbie Joined: Thu Dec 23, 2004 7:26 pm Posts: 11 Hi, I have an application that handles user data entry ...





17. row is not inserting into child    forum.hibernate.org

1.when I added insert="false" update="false", I am getting the following exception OrderPermitDTO.orderPermitUnitDetails -> orderpermitunitdetail 13:45:36,954 INFO [Configuration] processing association property references 13:45:36,954 INFO [Configuration] processing foreign key constraints 13:45:36,954 INFO [STDOUT] org.hibernate.MappingException: Repeated column in mapping for entity: c om.tollbrothers.archonline.valueobjects.archdoc.OrderPermitUnitDetail column: OrderNumber (should be mapped with insert="false" update="false") at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:487) at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java 2.and If i remove couple of tags then I ...

18. Can element be filtered from set if child set has 0 rows    forum.hibernate.org

Is there functionality which would cause an element be filtered from set if child set has 0 rows without having to make a filter on element to check if children would be returned? i.e Set: A (123) B C (456) D (789) A has a child set of 123 etc.... I would like B not to show up in set because ...

19. Mapping multiple rows to one persistent object?    forum.hibernate.org

Hi, I'm new to hibernate and I've run into a problem trying switch over an old project to use hibernate. In this project we have a table named 'Config' which consists of two varchar rows 'Parameter' and 'Value'. The table simply stores a key and a value for various configuration properties. The problem is that within the system the table is ...

20. How can I delete rows from a child table?    forum.hibernate.org

Hello - I am using Hibernate 2.1.6 and have a one-to-many association as shown below: ParentClass.java---------- Table: PARENT_CLASS ParentClass { Collection childClass; /** * @hibernate.set role="children" inverse="false" * cascade="all-delete-orphan" * @hibernate.collection-key column="parent_id" * @hibernate.collection-one-to-many * class="com.samples.ChildClass */ public Collection getChildClass () { return this.childClass; } } ChildClass.java---------- Table: CHILD_CLASS ChildClass { ParentClass parentClass; int number; /** * * @return * @hibernate.many-to-one ...

21. sql-query mapping for muldtiple rows.    forum.hibernate.org

Hi All, I have tried using named sql querries for mapping its resultset using hibernate to my class. For this, 1> i have created a class "Employee" having properties empId deptId empName salary 2> wrote a mapping for it in "Employee.hbm.xml" which is as follows: ...

22. mapping a table with 1 row and no id    forum.hibernate.org

23. Unable to delete rows from db of Map object.    forum.hibernate.org

I have a Map which is stored the a table "foobar_map". But I am having a problem deleting entries from the map and causing the row from the table to also be deleted. Code:

24. Prevent cascade update from deleting all child rows first?    forum.hibernate.org

Hi, I am facing a problem in Hibernate cascade update. I have a Customer with a mapping set of Pieces (with CustomerPiece-mapping in the middle) Customer.hbm.xml: ... ... CustomerPiece.hbm.xml: ... ... So the DB-structure goes like customer=>customer_piece=>piece. When I try to update ...

25. Updating child rows when parent is deleted.    forum.hibernate.org

Hi I am newbie to hibernate. I have a parent table and a child table. When I delete a row in parent table ( I am using cascade="delete" in hbm ) so all the corresponding rows in child table are getting deleted. . But my task is to update the corresponding child rows (insted of deleting) with null . I can ...

26. Mapping normalized rows    forum.hibernate.org

Hi all, I'm fairly new to Hibernate and I've been trying to figure out this problem with mapping normalized table data. I've looked through the FAQs, , a few tutorials, and several chapters in _Java Persistence with Hibernate_ book but was only able to find partial solutions at best. Let's say I have two database tables in a simple message forum ...

27. "Cannot add or update a child row: a foreign key constr    forum.hibernate.org

I have a optional relationship: in the database field 'placemark_id' is allowed to have a null value when I'm inserting a new object, property "placemark" is set to null, however, the database receive the following query: insert into event (type, title, start_time, end_time, trip_id, placemark_id) values ('ORDERED', 'Event 4', '2008-08-16 23:44:23', '2008-08-16 23:44:23', 3, 0) as ...

28. one-to-one mapping gives more than one row exceptions    forum.hibernate.org

public class Photo { ... private Thumbnail thumbnail; ... @OneToOne() @org.hibernate.annotations.Cascade( { org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DELETE }) public Thumbnail getThumbnail() { return thumbnail; } public void setThumbnail(Thumbnail thumbnail) { this.thumbnail = thumbnail; } } public class Thumbnail ...

29. one-to-one mapping gives more than one row exceptions    forum.hibernate.org

public class Photo { ... private Thumbnail thumbnail; ... @OneToOne() @org.hibernate.annotations.Cascade( { org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DELETE }) public Thumbnail getThumbnail() { return thumbnail; } public void setThumbnail(Thumbnail thumbnail) { this.thumbnail = thumbnail; } } public class Thumbnail ...

30. Mapping multiple db rows to one object?    forum.hibernate.org

(using Hibernate 3.3.1 and Annotations 3.4) I have all of my mappings working for my legacy database but ran into a roadblock on the design of one them. A quick overview. I have a base object: Code: @Entity @Table(name = "Objects") @PrimaryKeyJoinColumn(name = "objectid", referencedColumnName = "id")) @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public abstract class SuperObject { And its identifier: Code: ...

31. any mapping doesn delete orphaned row    forum.hibernate.org