Map 4 « Map « JPA Q&A





1. programmatic mapping configuration    forum.hibernate.org

I see in the reference manual section 4.1 that mappings *may* be defined with XML. I would like to explore programmatically creating the mappings. I see in the API: net.sf.hibernate.cfg.Configuration.createMappings(). The resultant Mappings object seems to suggest this kind of functionality. But the docs are silent on the use of the created Mappings object. Anyone have any ideas?[/b]

2. One-to-One Mapping Issue    forum.hibernate.org

Gurus ! I have a couple of tables which have a one to one relational mapping. When I assign an Address object to a Person and save Person, the respective records get created in the database tables but the Person_Id in the Address table is null. Can anybody please help to what I'm supposed to do if I need the Person_id ...

3. [INFO] JkCoyoteHandler - -RESET after attempt to map class    forum.hibernate.org

Hi all This has been driving me mad for days and I wonder if anyone can help? Environment = Tomcat 4.1.24, Apache 1.3.27 with mod_jk/1.2.0 After Hibernate has attempted to map a class to a database table (I presume in the Binder class), straight after the debug output: [INFO] Binder - -Mapping class:.........., JKCoyoteHandler resets. Does anyone know the reason behind ...

4. One-One mapping - Is this right ?    forum.hibernate.org

// Person Mapping File PERSON_SEQ // Address Mapping

5. 1-0..1 mapping    forum.hibernate.org

What is the best way to create a 1-0..1 mapping? I have an object of type servicecategory, which contains a collection (1-m) of servicetypes, which have a 1-1 with a service, which can be of any derived service type, one of which has a 1-0..1 relationship to a path. (Don't ask, no way to make it any simpler). I have currently ...

6. net.sf.hibernate.mapping package changes    forum.hibernate.org

A question for everyone: does anyone here use the mapping package directly already? I've just been cleaning it up a bit, so that we can "officially" expose this stuff to the application (which many people have asked for). I would really like to rename the class PersistentClass to Entity. Is this going to screw anyone up? If it is, I can ...

7. I have problem on one-to-many mapping too    forum.hibernate.org

Hi, I fully read the document on http://www.hibernate.org/hib_docs/reference/html/ . However, I still get problems in one-to-many mapping. I have two tables, OneCXN_User and USER_SMSISDN in Oracle 9i The relationship of OneCXN_User to USER_SMSISDN is one to many. I have created similar Objects for those tables in which OneCXN_User has a Set to collect all associate USER_SMSISDN records. However, when I query ...

8. one-to-many mapping again    forum.hibernate.org

Dear Sir, I have encountered one-to-many mapping problem using hibernate. I have two table one called OneCXNUser and one called UserSMsisdn. These two table also have a field called Imsi and many records in table UserSMsisdn can be mapped to the table OneCXNUser using this fields. When I can successfully add one record into the table OneCXNUser but nothing is added ...

9. Interface mapping?    forum.hibernate.org

A little bit more clarification of the problem in order to kick the tire here. All the class mappings so far in Hibernate are based on concrete classes and interfaces are only for lazy loading rather than reference purpose I am using. I am trying class/joined-subclass trick to make it more interface friendly (a good OO practice is acutally code on ...





10. One-to-many mappings problem    forum.hibernate.org

Hi guys, I'm new to Hibernate and I'm trying out a one-to-many design mapping, but I'm stuck in between. Can someone please help me? Storyline, Table 1 consists of 3 column where visit_id is the primary key Table 2 consist of 3 column where crane_id and visit_id is the composite primary key, visit id is the foreign key of table 1. ...

11. How do I map this?    forum.hibernate.org

Hey, have you read documentation carefully? "A special case of a composite element is a composite element with a nested element. A mapping like this allows you to map extra columns of a many-to-many association table to the composite element class. The following is a many-to-many association from Order to Item where purchaseDate, price and quantity are properties of the ...

12. how to mapping like this?    forum.hibernate.org

users Code:

13. How to map an interface    forum.hibernate.org

Hallo, I've got the following object model interface SellableItem; =>Set orderLines class Product implements SellableItem; class ServiceContract implements SellableItem; class OrderLine; =>SellableItem item; The relationship between SellableItem and OrderLine should be a bidirectional 1:n relationship. I've tried to map this but I always get an error using the ExportTool: Error: net.sf.hibernate.MappingException: Association references unmapped class: demo.myshop.model.hibernate.SellableItem I hope someone can help ...

14. Mapping Problem    forum.hibernate.org

I have two classes defined: public class ApplicationSpecification implements Serializable { private String id; private String vendor; private String name; private String version; private boolean rebootRequired; private java.lang.String installationNotes; private String description; private boolean licenced; } public class ApplicationInstance extends ApplicationSpecification { private String appInstId; private String installationOrder; private String notes; private String businessUnit; private String buildVersion; private String language; private ...

15. mapping changes?    forum.hibernate.org

16. Retrieving Hibernate Mapping    forum.hibernate.org





17. problem with one-to-many mapping    forum.hibernate.org

Hi, I'm sorry if this is something very obvious, but I've been trying to insert some data into PostGreSQL using Hibernate and it has not been working so far. I'm using Hibernate 2.1rc1. I have 2 classes Molecule, Atom Code: public class Molecule { // attributes private List atoms; //getter/setter methods } public class Atom { // attributes //getter/setter methods } ...

18. How to map Interfaces and their implementing classes?    forum.hibernate.org

Hello! I have several JAVA-Interfaces: a QUESTION and an ANSWER. The QUESTION-Interface is extended by two more interfaces: NumericQUESTION and TextQUESTION. The ANSWER-Interface is extended by the interfaces NumericANSWER and TextANSWER. Each Interface is implemented by a Class with Name [InterfaceName]+DTO, i. e. QUESTION is implemented by QuestionDTO. The "DTO" stands for "Data Transfer Object". Now I want to express that ...

19. many-to-many used in a map    forum.hibernate.org

Hello. Using Hibernate 2.0.3. I'm having problems creating a Map which represents a many-to-many relationship. I chose a many-to-many between students and classes as a classical example. I want a student to have a Map of classes, indexed by classId. My mapping document looks like this: Code:

20. many to many with maps    forum.hibernate.org

21. many to many with maps    forum.hibernate.org

22. Many-to-One bidirection mapping problem ???    forum.hibernate.org

Hello, How can I define a mapping by using XDoclet as following: Code: +------+ * +------+ | MAN | ----------------| CAR | +------+ 1 +------+ 1 man can have ...

23. Programatic Mapping?    forum.hibernate.org

24. one-to-one mapping    forum.hibernate.org

25. Mapping Question/Advice    forum.hibernate.org

I'm relatively new to Hibernate. I can write and use some basic mappings, but I've got a question. The answer will help me relate better to Hibernate and hopefully learn how some others have addressed the same issue. Let's say I wish to create a record of my music collection. The most natural breakdown for me was this: Code: public abstract ...

27. Mapping a one-to-many map    forum.hibernate.org

Author Message Tarka Post subject: Mapping a one-to-many map Posted: Tue Jan 06, 2004 3:02 am Newbie Joined: Tue Oct 21, 2003 10:47 pm Posts: 10 I want to model a one-to-many parent-child relationship with a Map, the key being the child's id. So I have the following classes (with xdoclets): Code: /** * @hibernate.class table="simple" */ public class ...

28. Is the following mapping possible..?    forum.hibernate.org

29. Include in mappings    forum.hibernate.org

I have many classes to map (more than 100) which has some common elements (some fields are present in all mappings). I have 1 mapping file for each class (for developing pourpose it's not possible to have only 1 mapping file) Is possible to use something like a "include" statement in mapping? I really whould like to write these common fields ...

30. mapping resource question    forum.hibernate.org

I'm trying to run the Cat test from the docs. It works when I have my database info in the serverl.xml, but I'd rather put my info in a hibernate.properties and load it in myself. My TestCat.java code looks like this: Code: Properties prop = new Properties(); ...

31. WHERE clause in map    forum.hibernate.org

I wanted to use a WHERE clause in my , cause I had, for the same kind of data, some limitations on the time. For instance, I used to filter on the date and added this string: but when Hibernate parse my WHERE SQL I can see that the Oracle SYSDATE is substituted with an ...

32. one-to-one mapping problem    forum.hibernate.org

hi all, i would like make the relation between AuctionItem and HomeInsurance, but it causes the error as following when i save the HomeInsurance object into database, anybody know what's wrong with it or my design have any problems, thanks : ERROR code: Code: java.lang.NullPointerException: attempted to save null at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:580) at net.sf.hibernate.id.ForeignGenerator.generate(ForeignGenerator.java:37) ...

33. Simple mapping    forum.hibernate.org

I have two tables. Table class and table instance. class: templateRefId; Instance: instId; templateRefId; There is a one to many between table class and table Instance. One row in table a will have many entries in the table b. for table Class the mapping is defined as follows :

34. One to Many mapping    forum.hibernate.org

I am having trouble mapping a one to many relationship. I have doubled checked everything with the samples and I can't see what is wrong. It looks ok to me. The exception is: 11:14:46,932 ERROR BasicPropertyAccessor:60 - IllegalArgumentException in class: au.com.company.app.common.model.StoreTransaction, setter method of property: stockNumber 11:14:46,932 ERROR BasicPropertyAccessor:64 - expected type: java.lang.String, a ctual value: au.com.company.app.common.model.StoreMaster Hibernate ExceptionIllegalArgumentException occurred while ...

35. many-to-many mapping    forum.hibernate.org

Hi, I have a class A and B with many-to-many relationship. The associate class is A_B. However, my associate class contains some properties. In this case how do I specify the many-to-many relationship in hbm.xml. Do I have to break them up as two many to one relationship and create the A_B class. Thanks Shishir

36. base mapping class    forum.hibernate.org

Regular Joined: Mon Nov 03, 2003 6:10 am Posts: 75 I was trying to use the Persistent base class pattern. I am using xdoclet tags to generate my hbm files. All I get is ">" however... I want it to use the ID from the Persistent base class. What am I doing wrong? ---------- ...

37. RTM-Done, still don't get it. one-to-one mapping    forum.hibernate.org

Hello, I have read the documentation on this, and searched the archives, maybe it is there but i could not find it. I have one java class that has to be mapped to 2 differetn database tables. Javaclass User id firstName lastName userName password role this has to go to 2 tables. DB table user id (pk) firstName lastName userName password ...

38. Mapping    forum.hibernate.org

I have a situation my tables are 1. Table A has fields id,tableB_id1,tableB_id2,name 2. Table B has fields id1,id2,Address 3. Table C has fields code,tableA_id,someInfo Code: TableA TableB TableC *ID ...

40. Mapping Interfaces    forum.hibernate.org

Thank you. Adding the class attribute did the trick. As for the Interface/Implementation issue, it may complicate the issue a bit, but I'm developing an Eclipse RCP based application, and in order to avoid extensive/circular dependacies between plugins, I place Interface definitions in a 'core' plugin, required by all (plugins). Now I have a Hibernate 'persistance engine' plugin that provides concrete ...

41. A peculiar mapping problem    forum.hibernate.org

Hi all, I have a domain object that is versioned (the current version is in one table and then each time it's changed, the last version is archived to a seperate table with the same structure). There are a number of tables that have a foreign key to the current version table. These tables also have an implicit foriegn key to ...

42. Modify where clause in mapping programatically?    forum.hibernate.org

I am using the 'where' attribute in the element quite successfully. However, for reasons of maintainability I would like to be able to externalise the content of the where clause so that I don't end up with a mapping file that, potentially, contains a large ugly 'where' attribute. I could then, at runtime, lookup the mapping and modify the 'where' ...

43. Multiple mappings for same class    forum.hibernate.org

Hi, Is there any way to specify so that I can use different mappings for the same class. We have couple of mapping files, one contains the whole heirachy with collection of sets and the other one is just flat. Based on different scenario, can i specify one mapping file over the other. In the below 2 mappings, Mapping 1 internally ...

44. One to Many mapping --> TreeSet ?    forum.hibernate.org

45. Mapping problem    forum.hibernate.org

46. One-to-one mapping problem    forum.hibernate.org

I'm not sure a one-to-one mapping is what you need: will a parent have possibly more than one child, but a child a single parent ? In such case, you should use a many-to-one (read from the Child): Code: ...

47. tricky mapping problem    forum.hibernate.org

Author Message ko5tik Post subject: tricky mapping problem Posted: Mon Feb 23, 2004 5:33 am Senior Joined: Wed Aug 27, 2003 4:08 am Posts: 178 Location: Wiesbaden, Germany I try to create relation ( map ) with subclass hierarchy. Say, I have base ( abstract ) class, I use a field ( "name" ) as map key ( it's ...

48. mapping interfaces    forum.hibernate.org

49. one-to-one mapping problem    forum.hibernate.org

Author Message tcollins Post subject: one-to-one mapping problem Posted: Tue Feb 24, 2004 4:51 pm Beginner Joined: Tue Jan 27, 2004 2:14 pm Posts: 40 Location: Atlanta, GA, USA I have the following class relationship... Person ---- User extends Person -------- Candidate extends User ... and Candidate has a CandidateProfile Here is the mappins for this... Code:

50. Speed up mapping and buildsessionfactory time    forum.hibernate.org

Hello, We'are developing a swing based client-server application with 220 mapped classes. Evrithing works fine with hibernate ! :-) The problem: We have mapped already 120 classes, but the mapping and building (sessionfactory) time are around 15-20 seconds, and more in debugging mode, and will be around 30-40 seconds at then end of the project. Is threre any way to speed ...

51. another one-to-one mapping question    forum.hibernate.org

Hi, I have two classes: Player and Address. There is a one-to-one association between them. Player has set/getAddress methods. I have two database tables, one for each. On Player there is a fk which should hold the id of the Address for that Player. The mappings for each are: ...

52. yet another one-to-one mapping question    forum.hibernate.org

I have two tables, SERVER and AGENT. The database model supports multiple agents per server, using a foreign key: SERVER --------- SERVER_ID HOST_NAME ... AGENT -------- AGENT_ID SERVER_ID SMTP_HOST RMI_PORT ... However, in our current application I want to make this a defacto one-to-one relationship. I've defined the hibernate 2.0 mappings as follows: Code: ...

53. One to One mapping    forum.hibernate.org

See Online manual for further details: There are two varieties of one-to-one association: * primary key associations * unique foreign key associations Primary key associations don't need an extra table column; if two rows are related by the association then the two table rows share the same primary key value. So if you want two objects to be related by a ...

54. Mapping question    forum.hibernate.org

Hi there. I've mapping question. I'm using database which is not done in the proper way. So eg. table looks like: Code: dummy(id, info_a, info_b, info_c, extra_a, extra_b) I would like to map this database without changing (because of legacy support) in object way. So I would like to have object "Dummy" and inside it 3 fields id, info and extra. ...

55. Mapping a map    forum.hibernate.org

I'm sorry to be such a beginner, but I hope you can answer this for me. I have a HashMap and the keys will all be strings, but the values will be different types of objects (String, Date, List). How do I map this? I tried: Code: ...

56. One-to-one mapping problem    forum.hibernate.org

Hibernate version: 2.1.2 Database : DB2 v8.1 There is a one-to-one mapping between my two classes,SubFoo and Bar. ---------------------------- Mapping is: ...

57. many-to-many mapping issue    forum.hibernate.org

New to Hibernate. I checked the manual too, i couldnt find the reason for the problem. I get this following exception with following settings. When i commented elements in mapping file to find out where the problem is happening. i get the following error ------------------------- net.sf.hibernate.QueryException: could not resolve property: weatherCurrent of: com.mycompany.weathermodel.model.WeatherLocationVO [ from com.mycompany.weathermodel.model.WeatherLocationVO as location inner join ...

58. mapping documents - From ODMG to Hibernate    forum.hibernate.org

Hello, I have to convert an ODMG mapping to Hibernate mapping. With ODMG you configure the connection information in the repository.xml file, and the mapping XML for classes in repository_user.xml. What is equivalent file for repository.xml file in hibernate? I have to configure the follow connection information, but I didn't see nothing similar in hibernate.cfg.xml file TIA