subclass 5 « Map « JPA Q&A





1. Issue with subclasses and one-to-one    forum.hibernate.org

Newbie Joined: Fri Jan 23, 2004 3:37 pm Posts: 14 Hi all! This post an issue reporting, not help support. I'm using Hibernate 3.0.5, and have a class hierarchy like this: IAccountOwner: top level Application: extends IAccountOwner and has a bag of accounts BasicElement: extends IAccountOwner and don't direclty relates to account Administrator: extends BasicElement and don't direclty relates to account ...

2. Problems Cascading joined-subclasses    forum.hibernate.org

Hi I have some problems with cascading delete. It works fine if I have normal one-to-many relations. But I need to use a class with two subclasses. If I delete the Parent I get the error below. I think cascading doesnt work. I tried to relate the Parent with the two subclasses, but it also havent worked. Thanks for help regards ...

3. union-subclass with many-to-one doesn't work    forum.hibernate.org

Beginner Joined: Tue Apr 05, 2005 12:09 pm Posts: 48 Location: Slovakia (SK), Koice (KE) Hibernate version: 3 Hi I use polymorphism "Table per concrete class" and if I define in union-subclass a many-to-one mapping then I have to do that in other union-subclass too, otherwise an exception is thrown. I've spent a long time to found that bug/feature. Code: ...

4. joined-subclass and getting sub-class    forum.hibernate.org

5. Table per subclass - changing subclass    forum.hibernate.org

Hibernate version: 3 Maybe I want too much from hibernate, but is it possible to change a type of the subclass? I vave 3 tables: CAT, DOMESTIC_CAT, WILD_CAT. DOMESTIC_CAT, WILD_CAT is in one-to-one relation with CAT. These tables are mapped to a 3 classes - Cat (abstract) and subclasses - DomesticCat and WildCat. Code: ... ...

6. possibly bug in using many-to-one in union-subclass    forum.hibernate.org

Beginner Joined: Tue Apr 05, 2005 12:09 pm Posts: 48 Location: Slovakia (SK), Koice (KE) Hibernate developers and/or gurus, please look at the following code I found suspicious that in Hibernate is bug. From following code the irrelevant properties and mapping was removed (and like that it was also tested). I've spent a whole day solving this problem with no result. ...

7. Regarding using subclass with discriminator    forum.hibernate.org

Hi. I have the foll. scenario: Table PAYMENT has been mapped using Table per subclass, using a discriminator with column "CARD_TYPE" of table PAYMENT as the discriminator column. I want to know whether I can use the same Java class for different values of discriminator???, i.e, can I have such a mapping: ...

8. using joined-subclass for Table per concrete class    forum.hibernate.org

Hi Using H3. Is it possible to use: Code: ... ... ... so that in the tag, there is no table="..." attribute specified? I just want to join tables specified only in joined-subclass. Maybe you would ...

9. Mapping subclass with same name but in different package    forum.hibernate.org

Is there a way of mapping the following? Let's say there's a class called 'regular.businessobjects.Product', which contains all the basic functionality for a Product to take from project to project. Now for a specific project, I want to override this class with a class of the same name in the project-specific package - so it would be 'myproject.businessobjects.Product'. Every attempt at ...





10. Problem querying with joined-subclass    forum.hibernate.org

Hi, I've just begun to explore the use of table-per-subclass mapping strategy via the joined-subclass element. Here's my set-up. I have 2 POJO classes as follows: 1. User, with fields id and name, where id is the identity key. 2. Employee, which is a subclass of User with additional fields, employeeID and department. I'm using SQL Server 2000, and am using ...

11. Natural IDs on a joined subclass?    forum.hibernate.org

12. joined-subclass and PropertyNotFoundException    forum.hibernate.org

13. Subclassing PersistentSet - no access to original set    forum.hibernate.org

Hibernate version: 3.0.1 ---- I have a set of elements to which I need to add some additional business logic methods. In other words, hibernate gives me back a "set" when it does a mapping and that's not quite enough. I need a "custom" set object back that has some additional methods that allow me to do totalling and filtering. ...

14. Modular mappings for subclasses with no additional fields...    forum.hibernate.org

Hi all, We are using Hibernate 2.1.7 in our application and allow end users to extend our object model with their own subclasses. The end users may not modify our default mapping files or code, but can specify their own subclass mappings using their own modular mapping files as specified in section 5.4 of the hibernate docs. This works fine using ...

15. one-to-many mapping to a subclass.    forum.hibernate.org

I am new to this fantastic framework and I have read the first 7 chapters of "Hibernate In Action". I also spent two hours in searching a similar issue but no luck. (I am sure that a similar situation has been discussed before but my schedule is so tight now. ) The situation is: ClassB extends ClassA and I used joined-subclass ...

16. Subclass and One-to-One relationship    forum.hibernate.org

Session session = null; try { session = PersistenceSessionFactory.getCurrentSession(); Transaction transaction = session.beginTransaction(); ...





17. Mapping Joined-Subclass with Discriminator    forum.hibernate.org

Hibernate version: 2.1.8 I have a Parent table that I would like to subclass using joined-subclasses, however, the ID on this table is not unique (it's a view combining disparate tables). I would like to preserve uniquity by using an OBJECT_TYPE indicator (maybe a composite-id?). Is there a way to do this such that I can make the OBJECT_TYPE a discriminator? ...

18. Bug with collection filters and joined subclasses    forum.hibernate.org

Author Message Juerg Staub Post subject: Bug with collection filters and joined subclasses Posted: Fri Jun 24, 2005 4:32 am Newbie Joined: Mon Apr 18, 2005 10:02 am Posts: 14 Location: Zrich, Switzerland Hibernate Version: 3.0.5 Mapping documents: ...

19. Strange behavior: mixed up Collections in Subclasses    forum.hibernate.org

I just encountered the same problem on my project. I use 2.1.X on my project. I have several instances where collections hierarchically in the same PersistentClass (that is collections that are in the class or any of its contained composites, recursively) that collect the same type have crosstalk. We are currently investigating the problem. It seems odd to us that we ...

20. Hibernate Criteria seaching on joined-subclass    forum.hibernate.org

21. union-subclass mapping generate wrong sql    forum.hibernate.org

Hibernate version: 3.0.5 Mapping documents: ... ... Hibernate generate sql query with UNIONs, where it tries to select from 3! tables ...

22. mapping collection of joined-subclass by parent field    forum.hibernate.org

I found several posts on this problem and haven't seen any answers. I am also facing the same exact issue where the in a collection always maps to the derived class table even when the foreign key is actually in the base class. It seems to me that the easy fix would be to allow specifying the table name to ...

23. How to use outer join with joined-subclass    forum.hibernate.org

24. No StaleObjectException with union-subclass inheritance    forum.hibernate.org

Newbie Joined: Wed May 25, 2005 7:24 am Posts: 11 Location: Austria I just have two classes, Being and Alien. Alien is derived from Being and I am using table per concrete class with union-subclass tag. After creating two aliens in the setUp() from my testcase I use two different sessions (s1 and s2) to load one and the same object. ...

25. Oracle LONG RAW Problem with Subclasses and Discriminator    forum.hibernate.org

I think I have a new flavor of the Oracle "Stream has already been closed" problem. The twist in my case is that I have subclasses and hibernate adds the discriminator column to the end of the query. From what I have read in the forums with other issues related to this, the suggestion is to read the column of type ...

26. one-to-one mapping on same table between subclasses    forum.hibernate.org

Hi folks, I've a Message object. Two subclasses inherit this object, Request and response. I want to have a one-to-one mapping between the Request and the response so that the response must have a request associated with it but the request might not yet have a response associated with it. The following is my attempt at the mapping. Code: ...

27. union-subclass and discriminator    forum.hibernate.org

Hi, hibernate 3.0 (DB oracle 9i), we are working on a requirement that every class below a particular class in the hierarchy must be collapsed into one table. For this I am trying to use discriminator with union subclass Suppose in model, class B inherits from class A and class C inherits from B. I want to create tables only for ...

28. one-to-many to a subclass with discriminator (fk in the sub)    forum.hibernate.org

Hi, I tought my problem was the same as in http://forum.hibernate.org/viewtopic.php?t=941990 but it is actually diferent, so I opened a new topic. In my case, the foreign key is in the subclass (in the other topic it was on the superclass). Im using a table per subclass with a discrimanator. I isolated the problem and created a new test case. The ...

29. newbie: unexpected query results with joined-subclass    forum.hibernate.org

Newbie Joined: Wed Jul 20, 2005 9:40 am Posts: 11 Location: Augsburg I am confused about the following behaviour: Code: return (Employee) s.createQuery("from Employee e where e.UID = :uid") .setLong("uid", new Long("1").longValue()) ...

30. hibernate3 query with a joined-subclass doesn't work    forum.hibernate.org

I have a class B which is a joined-subclass of class A. I have a class T that has a set of class B. I have a property "property1" defined on the root class class A. I have a HQL query that is on the joined-subclass class B: (select count(xx) from T.B xx where xx.property1 = :value1) = 1) This query ...

33. joined-subclass and cache tag    forum.hibernate.org

According the docs and dtd you can not specify a cache tag as a child of a joined-subclass. E.g., I was wondering why you can't specify this and if you specify the cache tag for the super class if it automatically caches all subtypes. Thanks for any help.

34. joined-subclass and multiple threads.    forum.hibernate.org

Code between sessionFactory.openSession() and session.close(): public class TestObjLayer { public static void main(String[] args) { TestObjLayer.testThread("MS1302"); TestObjLayer.testThread("MS1303"); } public static void testThread(final String barcode) { new Thread() { public void run() { System.out.println("Starting thread ID ---" + Thread.currentThread().getName()); Session sess = factory.openSession(); Transaction tx; try { tx = sess.beginTransaction(); //update some field. //update the object. ... tx.commit(); } catch (Exception e) ...

35. duplicate import - only if I have     forum.hibernate.org

Hi; I have a single hibernate.cfg.xml that has a single mapping: This mapping has two classes. I have Person and DemoRequest and the DemoRequest class extends the Person class. If I do not put the following in the Then I can run and access both the Person and DemoRequest ...

36.  PropertyAccessException    forum.hibernate.org

If I have the shown below I get: Exception in thread "main" org.hibernate.PropertyAccessException: could not get a field value by reflection getter of net.windward.store.demo.DemoRequest.demoRequestId If I comment out the lines, then it runs fine. Any idea what this means? hbm.xml: ...

37. Using joined-subclass    forum.hibernate.org

Hi; I tripped over this so I'm posting for those that may also hit this. When you create a table per subclass using , it works this way: ... ... The example I first read made me think it was the other way around. One further ...

38. unable to insert a record for joined-subclass    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp [b]Hibernate version:[/b] 2 [b]Mapping documents:[/b] [b]Code between sessionFactory.openSession() and session.close():[/b] List facilityLimitList=session.find("from NcFacilityLimit fac where fac.FacilityKey=?",ncFacility.getFacilityKey(),Hibernate.INTEGER); if(!facilityLimitList.isEmpty()){ System.out.print("hkj"); ncFacilityLimit=(NcFacilityLimit)facilityLimitList.get(0); } else{ ncFacilityLimit=new NcFacilityLimit(); } ncFacilityLimit.setCurrentLimitAmount(facilityVO.getFacilityLimit().getCurrentLimitAmount()); ncFacilityLimit.setFinalMaturityDate(facilityVO.getFacilityLimit().getFinalMaturityDate()); [b]Full stack trace of any exception that occurs:[/b] net.sf.hibernate.exception.ConstraintViolationException: could not insert: [com.nucleus.server.app.facility.persistence.facilitylimit.NcFacilityLimit#3509] at java.lang.Throwable.(Throwable.java:59) at java.lang.Throwable.(Throwable.java:73) at net.sf.hibernate.exception.NestableException.(NestableException.java:180) at net.sf.hibernate.JDBCException.(JDBCException.java:34) at net.sf.hibernate.exception.ConstraintViolationException.(ConstraintViolationException.java:35) at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:73) ...

39. joined-subclass 's problem    forum.hibernate.org

HI I use hibernate3 and xdoclet1.2.3. there are four classes.(user,group,actor,role) user extends actor group extends actor actor and role is many-to-many relation. This is the actor.hbm.xml mapping file that generated by xdoclet1.2.3: IdTable nextId

40. No insert when adding new joined-subclass object    forum.hibernate.org

41. Why do subclasses need to inherit parent primary keys?    forum.hibernate.org

Hello All, I am migrating an existing datamodel and trying to map hibernate onto to schema. I have seen post whihch are related to this issue, but have not been given a reason why this can not be done. Can anyone help? here is the encountered problem.... I have a relationship the is logically a subclass relationship (ie: user->agent user). But ...

42. Using collections in -style subclasses (mix TPCH    forum.hibernate.org

I am trying to mix TPCH and TPS strategies on a class hierarchy, but can't quite grasp how to do it when the leaf classes contain collections or one-to-many references. My naive approach (before reading the docs ;-) was Code: ... which parsed OK and also generated ...

43. table per subClass (with discriminator) vs joined subClass    forum.hibernate.org

I queried for information regarding performance differences regarding the table per subClass (with discriminator) vs joined subClass, but did not find the information to help me. I am pretty sure that the table per subClass (with discriminator) is the better performer. Does anybody have any tests or experience to confirm my suspision. Thanks. sorry, previously posted in wrong forum.

44. Can Criteria exclude a subclass?    forum.hibernate.org

...