collection 1 « Map « JPA Q&A





1. Hibernate map collection with constant key    stackoverflow.com

I'm trying to map a collection (of type map) using a foreign key and a fixed value as the key/mapping arguments. I have several tables of product types and a language table ...

2. Hibernate Mapping problem with unrelated collection    stackoverflow.com

Welcome, I've some problem with Hibernate mapping. Database structure:

TableA
 -ID_A --PK

TableB
 -ID_B --PK
 -ID_A -- FK -> TableA

TableC
 -ID_C -- PK
 -ID_A -- FK -> TableA
POJO structure:
class TableA extends Pojo {

 ...

3. Hibernate readonly collection mapping    stackoverflow.com

I'm taking the following many-to-many mapping example from this Hibernate Mapping Cheat Sheet:

<class name="Foo" table="foo">
  ...
  <set role="bars" table="foo_bar">
     <key column="foo_id"/>
   ...

4. JPA Collection mapping to Master table    stackoverflow.com

I have a number of ServiceDefinition entities. I'm trying to create a series of License entities that contain a reference to one or more ServiceDefinition entities;

@Entity

public class License {

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(unique=true, nullable=false)
private int ...

5. Mapping same entity to itself as a collection    stackoverflow.com

Ok, say i have a "Person" entity which needs to have "Person"s as property (say, friends) Since this is a many to many connection, If i'd create this schema using SQL (Which ...

6. hibernate: retrieving only part of child collection    coderanch.com

Hi everyone, I'm quite new to Hibernate, and in case this question had been posted many times before, I'm sorry for that. I have the following situation: Table A (Product) ----------------- - Id (PK) - related fields Table B (Product description) ---------------------------- - Id (FK) - Language - Description * There's a composite PK in table B (combination of Id and ...

7. mapping collections in hibernate    coderanch.com

8. Mapping qname not fond for the package: org.hibernate.collection    coderanch.com

Author Mapping qname not fond for the package: org.hibernate.collection white bastion Greenhorn Joined: Dec 12, 2008 Posts: 1 posted Mar 14, 2009 18:35:04 0 Greetings, I am using Axis2-1.4.1, Hibernate(3.2), apache-tomcat-6.0.18. I am able to persist java objects using Hibernate (REFER : Node.java and nodemapping.hbm) . (I have checked it, it works fine as a standalone stuff : DATA IS INSERTED ...





10. Mapping Collection in Hibernate.    coderanch.com

Hi All, I am starting to learn how to map collection in Hibernate. I saw various examples in net but I am finding it too confusing and unable to understand how to implement it practically. Please could anyone point me to a place where it is explained in a very simple and lucid manner so that I can get the basic ...

11. How do I map two collections of the same Entity in Hibernate?    coderanch.com

Ok, the problem was that Hibernate created link table with 3 columns: manager_id, action_id,reaction_id and was trying to insert there a row with only two values. I used @JoinTable annotation to provide two join table names to create two sepaarte join tables and it fixed the problem. I may guess that another way is to force Hibernate to add default value ...

12. Mapping collections    forum.hibernate.org

Hello. We have big hiearachy in our business application. Links to classes with big hierarchy stores in collections parameters. And i need optimisation for fetching this parameters, because if fetch objects by base class, then SQL will be big (20-30kb). May be we can load by first query uuid and discriminator from base table. And after we will group objects by ...

13. issue with defining collection mapping    forum.hibernate.org

Newbie Joined: Wed Nov 04, 2009 11:50 am Posts: 3 Hi All, Could any one please read this and suggest how I should address my problem. Brief explanation of my problem: When the given java code snippet executes , permissions collection is invoked from hbm.xml. It generates SQL query that contains join between PERMISSION and PERSISTENCE which is not like what ...

14. one-many mapping Found shared references to collection issue    forum.hibernate.org

Newbie Joined: Mon Oct 26, 2009 9:28 am Posts: 1 Hi, I am trying to create hibernate mapping file for saving XML -to database using dom4j.we have one main table for all attribute of parentelement/childelements with only one occurence and seperate tables for child elements with multiple occurences. So i am using one-to-many within collection mappings but its giving me shared ...

15. Mixing NaturalId with Collection mappings    forum.hibernate.org

Hi, I use NaturalIds for all my objects and have recently run into an issue. Some of my objects define their uniqueness through a homogeneous collection of objects. Unfortunately when I map this collection with @ManyToMany as well as @NaturalId then I get the following error: Caused by: org.hibernate.MappingException: Unable to find logical column name from physical name null in table ...

16. Mapping Set collection within Map    forum.hibernate.org





17. Mapping a collection of collections    forum.hibernate.org

18. Illegal attempt to map a non collection    forum.hibernate.org

Newbie Joined: Tue Sep 28, 2010 7:27 am Posts: 1 Hi all, I am using annotation, below is the error i am getting, Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: com.data.items.dao.system.pojo.Menu.menuRoleAccess This is my Menu POJO: public class Menu implements java.io.Serializable { /** * */ private static final long serialVersionUID = 1L; // Fields private ...

19. Incorrect mappings: collection was not processed by flush()    forum.hibernate.org

Hi all Please help me with my incorrect understanding of mappings, cascade and flush. I have various data model classes that are linked: Event --> EventDateTime --> TicketCategory -->ManyToMany<-- Block. The Block data model is also linked via another path: Event --> Venue --> Layout --> Block --> Seat. Currently my test data does not include any Layout, Block and Seat ...

20. Mapping a table with a collection to itself    forum.hibernate.org

The entity i want is this: Code: class ExternalAccounts { private String externalAccountType; // part of key private String externalAccountId; // part of key private Set accountIds; // collection of account ids } My table "external_account" looks like: external_account_type(string), external_account_id(string), account_id(integer) Clearly i can have many different accounts for a particular "key" (ie, externalAccountType ...

21. Mapped Collections Broken in 3.6.2    forum.hibernate.org

I have an Employe entity with a mapped collection for phone numbers Code: @ElementCollection(fetch=FetchType.EAGER) @CollectionTable(name="emp_phone") @MapKeyColumn(name="phone_type") @Column(name="phone_num") private Map phoneNumbers; When I try to create a criteria API over it: Code: CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery criteria = builder.createQuery(Employee.class); Root employeeRoot = criteria.from(Employee.class); criteria.select(employeeRoot); MapJoin phoneRoot = employeeRoot.joinMap("phoneNumbers"); criteria.where(builder.equal(phoneRoot.key(), "HOME")); ...

22. Hibernate Collection Mapping.    forum.hibernate.org

Hi Friends, I am a novice Hibernate learner. I am starting to learn mapping collections in hibernate. I have searched the net for the examples for the same but it looks very confusing. More over I am reading the book "Java Persistance with hibernate" by Christian Bauer and Gavin King. In the book examples also of Item and Image I am ...

23. JPA 2 weird behaviour when Mapping basic Collections    forum.hibernate.org

Newbie Joined: Wed Jul 13, 2011 8:15 am Posts: 2 My situation is the following: I am mapping a simple one-to-many relationship I have done many times before successfully without too much thought. However yesterday after starting anew project and downloading the latest hibernate jars I experienced some strange behaviour when using JPA Annotations to map a one-to-many. In a nutshell, ...

24. Issue mapping collection and querying    forum.hibernate.org

i need to query based on the CUSTOMER_ID mapped inside the bag "restricted" Query = FROM Part as part left outer join part.restricted as auth WHERE auth.CUSTOMER_ID = :customer creates this exception : cannot dereference scalar collection element: customer_id ...

25. Mapping same entity to itself as a collection    forum.hibernate.org

Ok, say i have a "Friend" entity which needs to have "Friend"s as property Since this is a many to many connection, If i'd create this schema using SQL (Which i'm not, i'm using the hbm.ddl.auto to do it for me) i'd probably make another table containing 2 columns with 2 ids (1 for each friend) However, i'm not sure how ...

27. Map collection in several tables to single many-end table    forum.hibernate.org

Hi, I have a mapping problem. I have 20 lookup tables that should hold 'name' and 'description'. The description must be multi-language so I want to put the description column in another table with a one-many association (or a Map). But I dont want 20 description tables, I'd like to have only one description table that holds description for all 20 ...

28. Collection Map    forum.hibernate.org

I have table A, table B and table C. table A { id_col (Primary Key) } table B { asociation (Primary Key) id_col (Foreign Key) name other fields } table C { asociation (Primary Key) other fields } This model was defined by "the architect" and I can't modify it. In my object model C is a subclass of B. I ...

29. Collection/Map at Multiple Level    forum.hibernate.org

Hi all, I have a class X (say) which has a Collection/Map which is supposed to contain objects of class Y. Now class Y has a Collection/Map which is supposed to contain object of class Z. I am giving the dummy code below. public class X { private Map = ymap; // This Map contains object of class Y public X ...

30. Mapping a Collection to inherited classes    forum.hibernate.org

I have an object model like the one in chapter 18.2 (Author/Work). In that example, there is a collection in Author class to get the works made by a concrete author: But how can I do a mapping to get directly, for example, all the books written by an author? ...

31. how to map "this" collection?    forum.hibernate.org

hi all, Suppose I have a scenario: Table AMO --> ID,....... Table AMOACO--> AMOID, ACOID ( both fk and together pk) Table ACO--> ID,.......... Class AMO: Long ID, list acos ... Class ACO: Long ID, .......... 1 AMO ---> * ACO I wonder that how can I set this one-to-many relation in the mapping file just using the AMOACO table only ...

32. Hibernate collection map and surrogate keys    forum.hibernate.org

We have a collection mapped as a Map to a table that has a surrogate key. In our mapping we specify a key, index and a composite-element. Our issue is that the surrogate key in this table never gets updated in the mapped table. Question: 1. Should we foregoe the surrogate key here? 2. Is there a way for the mapped ...

33. how to map a collection of sub-classes?    forum.hibernate.org

for example, Cart and Item are 1:n association. But the Item table is mapped to a class hierarchy, e.g. Item_A, Item_B. In Cart, I need just a collection of Item_A. How to write it? I have the following mapping, but seems not working: It just pull out all Items.

34. How to map two collections onto one table?    forum.hibernate.org

Hi. In my classI have two lists with elements of the same type. Code: /** * Objects of the following type(s) are allowed in the list * {@link my.MultilingualType} */ java.util.List getDescription(); /** ...

35. Simple pseudo-code to understand collections mapping    forum.hibernate.org

Author Message avaraujo Post subject: Simple pseudo-code to understand collections mapping Posted: Fri Aug 13, 2004 3:50 pm Newbie Joined: Fri Aug 13, 2004 3:36 pm Posts: 1 I try to simplify the selection of a collection with this pseudo-code. I think can be of some help for a beginner like me, but may be I have some errors. ...

36. Collections mapping question    forum.hibernate.org

As part of a skinny DAO framework built on top of Hibernate, I'm trying to automate some of the way bi-directional one-to-many relationships are handled. Specifically, upon saving a new child object, it would automatically add it to the relevant collection(s) of its parent object(s). To keep a lot of cruft out my POJOs, I'd like to discover (child property) --> ...

37. mapping one table to one objectand collection of other objec    forum.hibernate.org

en francai peut etre c plus claire: g une table table1 dont la definition est: id number login varchar2 passwd varchar2 A1 number B1 number C1 number A2 number B2 number C2 number cette table doit etre mappe vers la classe CLASS1. dans table1, g une serie de colonne A, B et C ( c un modele de donne qui n'est ...

38. Can Hibernate map one table to multiple collections?    forum.hibernate.org

I am developing my first Hibernate application, which will be used to manage stores for a grocery chain. The Store object owns a collection of items, called ExtraordinaryTimetable, representing extraordinary opening and closing hours on special days (e.g. holydays). The timetable objects are subject to a workflow, so they have a "status" property. I first modeled this association with a Set ...

39. Problem with mapping collections    forum.hibernate.org

Hi, I'm terribly delayed by this problem and I can't find a solution. The exception araise at the very beggining when I try to create a sessionFactory based on HibernateUtil example from Hibernate Reference. I don't understand why I'm getting this mapping Exception. Thanks in advance. Hibernate version:2.1.3 Mapping documents:

40. Mapping Collections    forum.hibernate.org

I don't know if this is how Hibernate is supposed to work or I am doing something wrong. I am mapping a collection as a BAG in a many-to-many relation. Whenever the java List is structurally changed like an element is added or removed, when I do a saveOrUpdate Hibernate deletes all records corresponding to the List and then inserts new ...

41. One-to-one mapping, collection    forum.hibernate.org

Hi, I have a mapping-problem with hibernate. Let me explain the situation. I have an Entity-class and an EntityDescription-class. The entity class stores general entity information while within EntityDescription there are descriptions and titles for entities stored for several languages. EntityDescription consists of two Maps: titles and descriptions. An entity must not have a description for every possible language. So, the ...

42. "map" collections    forum.hibernate.org

43. Unmodifiable child collections    forum.hibernate.org

public class Parent { ... private Set children ... public Set getKittens() { return java.util.Collections.unmodifiableSet(kittens); } public void addChild(Child c) { c.setParent(this); children.add(c); } }

44. [newbie] Collection mapping problem    forum.hibernate.org

Hi, I have 2 tables (on MySQL, * = primary key). 1. Flight (flight_id*, flight_number, ....) 2. Stopovers (flight_number*, airport*, list_index) I've got one class (Flight.java) and want to maintain a List of airports within based on the flight number(which is not the key). Code: public class Flight { private String flightId; private String flightNumber; private List stopovers; public String getFlightId() ...

45. strange mapping of collection    forum.hibernate.org

I have a class "Node". A node is linked to other nodes as in a graph. Anyway I only need to know the nodes which are in the outgoing edges of a node. I have a linking table "linker" who have 3 fields: -id -node_id -linked_node_id so if i want all the nodes linked to the node with id = 1 ...

46. Hibernate collection mapping gone mad!    forum.hibernate.org

I have a problem with a collection mapped using hibernate. The main table is called Node and has an associated table with its attributes identified by key value. When in try to put and get values everything is perfect and the mapping acts as it is supposed. The main problem comes when querying through HQL. Then hibernate simply gets mad and ...

47. Glitch with CHAR based collection mappings    forum.hibernate.org

In a legacy database that I am accessing via hibernate I have a table [Claim_Detail] indexed by char(19) [Claim_Number]. I also have a table [Diary] that references [Claim_Detail] using char(22) [Ref_No]. There is no foreign key constraint defined. A foreign key would probably fail as the fields are different lengths, and I think [Ref_No] is used for other purposes. In the ...

48. hibernate collection mapping issue    forum.hibernate.org

I've been stuck on this one for a couple of days and it has baffled me and other hibernate users I know. The problem goes like this: In my hibernate mapping model I have two classes Ainc and ExpNote. I've listed the mapping docs below. ExpNotes has three subclasses ExpNoteAinc, ExpNoteBill, ExpNoteSL. There is a one-to-many relationship between Ainc and ExpNotesAinc. ...

49. hibernate collection mapping issue followup    forum.hibernate.org

50. Simple Collection Mapping Question    forum.hibernate.org

OK this is just a simple usage question and I apologize for posting something so basic. I'm not having any problems doing some object->object type matching but the simple stuff is what's getting me. Here's an example: example database tables: create table person ( id char(32) primary key, name varchar(128), ); create table aliases ( personid char(32), alias varchar(128) ); Make ...

51. Map of Collections    forum.hibernate.org

Hi, I know that Hibernate doesn't handle nested collections. Can anyone recommend, then, how to map this relationship TABLE payee - payee_id (PK) TABLE payment_detail - detail_id (PK) - payee_id (FK) - payment_type given I'd like to be able to do the following: { // ... Payeee payee = // load payee by id ... Set paymentsType1 = payee.getPaymentOfType(type1); Set paymentsType2 ...

52. collection mapping    forum.hibernate.org

53. returning a collection of maps from a query    forum.hibernate.org

Is there a way to return a collection of maps rather than a collection of Object arrays in Hibernate when using queries that contain aggregation functions? For example: select sum(rc.score) as totalScore from ReportCard rc As an object array you have to refer to the result by index. But if it were a map, you could refer to it by column ...

54. How to do collection mapping for this case?    forum.hibernate.org

Hi all, I'm new to Hibernate and I bumped into a problem. I have a table that holds string data. Other tables use this table to store large string data and they hold only the corresponding ID of their entry in Strings table. For example: Strings table: ID int PK, DATA varchar(4000) OtherTable table: ID int PK, NAME varchar(50), ID_DATA int ...

55. collection mapping    forum.hibernate.org

Hi All, I am getting a following error when trying to map hibernate collection: Foreign key (media_group [media_owner_id])) must have same number of columns as the referenced primary key (Overview [prop_id,type_id,locale_code]) Is it possible to create such a mapping where only one primary key would be used for mapping one-to-many relationship through a config file instead implementing onLoad method from within ...

56. Mapping advice needed: different collections to same table    forum.hibernate.org

Yes, I've been able to do what you're talking about. Look in the guide for "discriminators". Basically you need a column in the table to differentiate which collection a row in the table will belong to. In the case which I'm working with, each collection is mapped to a different class, each defining their discriminator value. Each of these classes extend ...

57. using where clause when mapping collections    forum.hibernate.org

Ok, this is a hard question. I am using version HB 2.1.8, on Oracle 9i. Take a look at the following mapping:

61. Collection mapping :     forum.hibernate.org

The Problem is not to give you an example for a map, but the example you are giving is a one-to-many relation between PRODUCT and PART. So you have one PRODUCT with a set or list of PARTs. If you want to use a map than what should be the key and the value?

62. Mapping collection of collections    forum.hibernate.org

63. Mapping collection of object    forum.hibernate.org

I want to map collection of objects. So far in java I was using Vector to hold them and I would be happy to stick with the Vector type instead switching to Set, Bag, List, or Map. Is there any workaround so one can use Vector to hold objects and still be able to hibernate such a class ? Sincerely, Pawel ...

64. Collection mapping    forum.hibernate.org

I think what you're talking about is just a plaing ol' java object that you're going to have to load yourself since hibernate has no idea how to create it. This might be the most efficient way since you might want to be doing custom relationship mappings anyway for your collections. I have tons of these kind of POJOs that the ...

65. Collection Mapping question    forum.hibernate.org

Hi - I have two entities: Product (id: int) and ProductName (composite-id: fkProduct, language). What would be the best way to collection-map both: I thought about a map in which the language is used as the key, so I can do: ProductName pname = (ProductName)product.getNames().get(language); but if I use , I have to define a key which is corresponding to the ...

66. WHERE clause from class mapping not used in collections?    forum.hibernate.org

Does the WHERE clause that is declared in a class mapping get disregarded when that class is loaded in a collection? Does it only apply when the class is loaded by id? Hibernate version: 3.0.4 Mapping Documents Class with WHERE clause:

67. problem with references in map collection    forum.hibernate.org

hi all, I have a problem with the mapping of a map collection and it is driving me crazy. See the details below: Hibernate version: 3.0 Mapping documents:

68. Mapping concrete collections    forum.hibernate.org

In this highly edifying post: http://blog.hibernate.org/cgi-bin/blosxom.cgi/2005/03/11/ Gavin refutes numerous untrue statements about Hibernate, but, in passing happens to mention that "No Hibernate user has ever asked for support for concrete collection classes". Well, consider this your first request! I have been looking through the updated versions of the proxy and property packages for Hibernate v3 which Gaven has mentioned are the ...

69. Collection Mapping    forum.hibernate.org

Newbie Joined: Thu Oct 06, 2005 9:30 am Posts: 18 Location: Canada I have the following two classes public class A { int id; String name; Set set = new HashSet(); public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = ...

70. 'stateful' mapping (collection) table    forum.hibernate.org

Hi all, I have a mapper table in many-to-many mapping that maps contacts to office. This mapper table has some state columns (like date registered, position, active....) that belongs really to Contact class. So I thought to I would map all these columns into my Contact class. But I am having serious problems. Instead of giving you my whole mappings (which ...

71. Collections mapping    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3 I have 3 tables - Location, LocationGroup and OrderedLocations. A location can belong to many location groups and a location group can have many locations. The ordered locations table is to hold the collection but has one extra column in it, which is why I have a bean ...

72. Syntax for where in collection mapping    forum.hibernate.org

Newbie Joined: Fri Jan 20, 2006 2:19 am Posts: 4 I have trouble finding example of how to use the where i collection mapping see below line 9 (useful if the collection should contain only a subset of the available data). Code:

73. Mapping Collection of UserTypes    forum.hibernate.org

Hi, I have a POJO with this getter/setter methods /** @hibernate.property type = "gov.osc.pl.URLUserType" column= "file_url" * @return Returns the fileURL. */ public URL getFileURL() { return fileURL; } /** * @param fileURL The fileURL to set. */ public void setFileURL(URL fileURL) { this.fileURL = fileURL; } I have URLUserType class to Map url to database and it works fine. But ...

74. Trivial collection mapping not working    forum.hibernate.org

Hi I'm having problems with what I expected would be an absolutely trivial mapping. I have two classes, Methodology and Decision. For each methodology there can be many decisions, and decisions can't exist without a corresponding Methodology. The problem is that for my simple test I have a Methodology which I know has 3 Decisions. But when I load the methodology ...

75. Collection Mappings    forum.hibernate.org

Hi, I am having problems with the collection mapping in hibernate. The documentation does not explain enough for me. They only go through and explain the map and then do a few bits and pieces on the other ones throughout that. So anyways, it has made it difficult for me. I have spent the past 5 hours beating my head against ...

76. mapping entity with collection, to 2 identical tables    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.1.2 I use entity-name to map one object into 2 tables: the "real" objects and the "archived" ones: i duplicate the hbm files, and replace some class="..." with entity-name="...". Now i want to move a record from the real table into the archived table: session.delete("real",o); session.save("archived",o); Actually my object ...

77. Mapping collection    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hi, Im having a trouble when I tried to access a collection, and I am not seeing the error follow de mapping. and the execption Hibernate version: 3.0 Mapping documents: PROCESSO has a collection of Encaminhamento

78. Best Practice for intercepting changes to a child collection    forum.hibernate.org

Here is the mapping: Code: ...

79. Can this be done using collection mapping?    forum.hibernate.org

Hi, This might seem easy but I cannot find an example... This is the situation: I have Customer (id,name,code) and Appointment (id,notes,customer_code). 'customer_code' is a Customer's 'code'. Field 'customer_code' in Appointment can be null; each appointment does not have to relate always to a customer. Can we map using a collection, e.g. a , the appointments of a Customer? e.g. customer.getAppointments() ...

80. How should I map a collection?    forum.hibernate.org

Hibernate version:2 Oracle 9 Hi. I am having a problem when I map a collection to a transfer object. I have 2 TO's, like, Order and OrderItem: class Order { Integer idOrder; } class OrderItem { Integer idOder; Integer idOrderItem; } When I create an order, idOrder is crated by a sequence. So, if I instanciate an Order an populate it ...

81. Mapping Collections of Collections?    forum.hibernate.org

I am no expert, but as far as I know you can only make a mapping of keys (String, Number and subclasses) to mapped entities. java.util.Set is not an entity, so my immediate answer would be no. However, you can make a mapped entity implement java.util.Set. Now that would be akward, but anyway... The other path would be to create an ...

82. Mapped collections and paged query results?    forum.hibernate.org

83. Collection of an Interface: how to map?    forum.hibernate.org

Hi, hi have been using Hibernate for quite a while and I am very satisfied by it. I am facing a new problem today, here it is. I have a collection that looks like this: List myElements; MyInterface is an interface with only two known and annotation-mapped subclasses. How can I possibly map such a collection? I can persist the single ...

84. Collections - Map    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.1.3 Hi Guys. Am having some problem with Collections and was hoping someone can give me few ideas how fix the issues. here is the problem. I am using Map Collection to do one-to-many association and the map key i am using is the id attribute of a Object. ...

85. Problem with mapping a collection.    forum.hibernate.org

Hi, I'm new to hibernate and got stuck with a problem. I got an Item class which holds a list of rents. The problem is that rents can be removed, but this change isn't visible in the database of course when updating the Item object. How can I implement such a thing in a good way?

86. Collection of inherited objects    forum.hibernate.org

Hello Everybody, I have the following DB schema (A,B,C,D and E are tables, the - sign shows association): A-B-C B-D B-E A-B is one-to-many B-C is one-to-one B-D is one-to-one B-E is one-to-one C, D and E are inherited from B. ex: ... ... ...

87. How would you collection/map this Map? Any ideas? thanks    forum.hibernate.org

Beginner Joined: Thu Feb 26, 2004 11:45 am Posts: 45 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.2.1 I'm trying to figure out a straightforward way of mapping a class with a composition to another class using a HashMap. Seems straight forward, but i'm having a little problem. Consider Company maintains a collection of Branches, keyed by ...

88. How to map a Map of Collection?    forum.hibernate.org

89. Mapping of interited class collection    forum.hibernate.org

90. Mapping a roll-up collection    forum.hibernate.org

Hibernate version: 3.4.2sp1 Name and version of the database you are using: Postgresql 8.2 I'm running into a mental brick wall trying to work around a problem in an existing database. I have a main table ("Main"), and several other child tables ("ChildA", "ChildB", and so on). I also have another table, "Info", that has an relation to the "Main", ...

91. Child set collection filled incorrectly    forum.hibernate.org

Newbie Joined: Tue Feb 12, 2008 11:36 pm Posts: 1 I can't seem to figure why this is happening. I've mocked up a scenario to illustrate the problem. I have a Employee class which contains a set of dependent classes. When I do HQL to get all the Employees, the dependents for each employee is either the first or last employees ...

92. Question on collections mapping    forum.hibernate.org

I assume that Student and Grades are defined as two separate tables? I also assume that a student can have more than one grade. I also assume that the CourseName is part of the ID of your Grade record; as your example implies. If so you can have hibernate use the object graph on the heap to determine the relationships between ...

93. Mapping collections with surrogate keys    forum.hibernate.org

I was tryin to map a collection of Car objects using a list. I could map them to the table however i could not generate a surrogate key. @Entity @Table(name= "garage") public class Garage { @Id @GeneratedValue @Column(name = "garage_id") private long id; @org.hibernate.annotations.CollectionOfElements( targetElement = Car.class) @JoinTable( name = "car", joinColumns = @JoinColumn(name= "garage_id")) @Column(name ="carname") private List auto = ...

94. Many-to-Many Collection Mapping Issue    forum.hibernate.org

I'm having trouble trying to create a hibernate mapping file for my application. The POJOs that I coded consist of Employee, Skill, Skill Level, and EmployeeSkill. I would like to code a method in the Employee POJO called getEmployeeSkills() which returns a collection of EmployeeSkill objects (maps skills with skill level to an employee). Given the scenario that I just described, ...

95. Problem mapping a collection, seems like it should be simple    forum.hibernate.org

Hi all, Suppose I have a table PRODUCT with columns ID, DESCRIPTION, and TYPE. My goal is to map a Product class. It has a set "similarProducts" that contains all Products with the same TYPE value as the parent Product. (It is OK if similarProducts also includes the original parent Product.) I'm trying to avoid creating a separate association table because ...

96. Mapping a Collection containing a Collection    forum.hibernate.org

97. Why simple collections aren't mapped as a CSV?    forum.hibernate.org

I know there are ways to achieve this, but they're far from common, it's something I don't ussually see. I wonder what are the advanbages of the extra table approach. As an example, consider this: Code: public class Car { private String model; private String year; private Lit availableColors; } "availableColors" can ...

98. Mapping a collection of entities from two different classes    forum.hibernate.org

Hi, I am trying to map 2 different parent classes with a one-to-many to a set of child classes of the same type, but then hibernate complains that _propertyNameBackref is already mapped. This is the current situation: Code: // The parent classes @Entity @Table(name="t_holiday") public class Holiday implements Serializable { private static final long serialVersionUID = -3948723008730842068L; ...

99. mapping of collection and class    forum.hibernate.org

No i don't want to know the owner of the collection .. i am putting my problem through an example : i have a "Person" class which has a set named "addresses" and this set is mapped to the "Address" class in the person.hbm.xml file . now at run time ,using configuration property i am able to list all the collections ...

100. Why would anyone use a Set for mapping a collection    forum.hibernate.org

I can't speak on why jsf uses a list, but that seems perfectly acceptable. JSF is a different library from hibernate so there really is not a correlation between the 2. I use sets whenever appropriate. If I want unique values only for instance. It also has a small footprint then a list. As in any language you shouldn't be using ...