Discriminator 2 « Core « JPA Q&A





1. discriminator from other class??    forum.hibernate.org

hi all i would like to to a subclass mapping and was wondering if a can use a discriminator from another class?? I have a mapping of table TKURS which has several columns, and a foreign key to table TANGEBOT. There are different types of KURS which i want to define in my subclass mapping. The type of the KURS/ANGEBOT is ...

2. discriminator formula    forum.hibernate.org

Hello all in my mapping file i have the following discriminator formula: Code: ..

4. Collection retrieval query does not use discriminator    forum.hibernate.org

Hibernate version:3.2.0.cr2 From JBoss 4.04GA Oracle 9.2_06 We have implemented one table per class hierachy and have an abstract Companies class with subclasses for each of the specific company types in our system (and the relevent discriminators). The GroupCompany is the parent of BrandCompany (amongst other types) so has a collection of "brands". However when we get the brand companies collection ...

5. Boolean discriminator    forum.hibernate.org

6. Discriminator issue with parent.getSubclasses()    forum.hibernate.org

I have an issue with selecting what I want using the inheritance option and discriminator columns. I am placing classes Person, Child, and Parent in the same Person table using person_type = PERSON_PLAIN, PERSON_CHILD, and PERSON_PARENT as the respective types. Also, I have one to many relationships with Household class and get and set methods returning Collection and Collection. I used ...

7. Discriminator not working    forum.hibernate.org

I am using Hibernate 3.1. I have a simple table Employee. I want to use discriminator on a column called Emp_Type_Id. A specific value of this discriminator should create a subclass called Manager. Can you please tell me what did I define wrong in following hbm.xml as it is not creating a subclass pojo? Thanks in advance R

8. Discriminator with class name value    forum.hibernate.org





10. Property discriminator for many-to-many relationship    forum.hibernate.org

I have a parent object that can have two different types of children (call them Red children and Blue children). My object model looks something like the following: Code: public class Parent { public long getId(); public void setId(); public List getRedChildren(); public void setRedChildren(List c); ...

12. Using discriminator in a hibernate Query / problems    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0 Mapping documents:

14. retrieving the value of discriminator    forum.hibernate.org

15. Discriminator formula wrapping value in quotes twice.    forum.hibernate.org

Hibernate version: hibernate3 3.2.1 hibernate-annotations 3.2.1 Mapping documents: Code: ...

16. External discriminator column    forum.hibernate.org

I'm working on mapping some legacy tables and I've run into an issue where a table per class inheritance structure is used but other tables that refer back to the sub class tables have a discriminator column that indicates which of the sub class tables to use. Is there any way to map this in hibernate so it hibernate doesn't do ...





17. Discriminator question    forum.hibernate.org

I'm declaring a property as a discriminator the value never changes in the DB when persisting either the parent class or the sub class. When I persist the subclass (ForumDTO), I have the isForum property set to true. But Hibernate inserts the record with that column set to false. What am I missing? Thanks in advance. Hibernate version: 3.2 Mapping documents: ...

18. Many-to-one Relationship Discriminator?    forum.hibernate.org

Is there a way to tell Hibernate to put an extra column in for a many-to-one relationship to tell it exactly what table to query for the associated object? We are using a table-per-concrete-class table structure in our database and I have an entity class that has a many-to-one relationship with a class high up in the inheritance tree. I don't ...

19. Criteria restriction on discriminator column?    forum.hibernate.org

I've searched all over for the answer to this question, and can't find any answers. I feel like the answer should be obvious, but I've tried everything I can think of. Here's the problem: I have a class, ApplicationEvent, that contains an Endpoint object, with a many-to-one mapping. Endpoint is actually an abstract superclass; I only instantiate its subclasses, EndpointA and ...

20. No discriminator found for.. PLEASE HELP!!    forum.hibernate.org

Hi Guys, Any help here would be great. I have got two classes ChildXMLClassElement and RootElement whic extend XMLClassElement and I decided to use the table per class hierarchy. My mapping file is as such.

21. [HQL] discriminator-value in where-clause    forum.hibernate.org

Hibernate version: 3.2.2 Mapping documents: Code: ...

22. Discriminator not working right    forum.hibernate.org

In my current database we use logical deletions. This means that there could be many items with the same id, but we enforce that only one of them is active (i.e. the column is_active=Y) at any given time. However, the basic Session.get() doesn't look at any columns other than the given id column, so if I try to call get on ...

23. Discriminator in One to many relationship    forum.hibernate.org

Hi, I have a class Profile, that contains a one to many association to a Node class, via a link table. The link table contains a column excluded, that specifies, if the the node is included or excluded from the profile. PROFILE ====== ID NAME PROFILE_NODE_MAP ============= PR_ID NODE_ID EXCLUDED_FLAG NODE ==== NODE_ID NAME What is the best way to represent ...

24. Shared join table with discriminator    forum.hibernate.org

Hibernate version: 3.2.3 Name and version of the database you are using: MySQL 4.1 I have these classes: Code: class FileBean { @Id @GeneratedValue(strategy = GenerationType.AUTO) int id; // other properties } class ActivityBean { @Id @GeneratedValue(strategy = GenerationType.AUTO) int ...

25. Custom discriminator delegate    forum.hibernate.org

I need to implement complex discriminator functions based on information that is not contained in the row, or even the schema. I have xml configuration files that determine the type of object that needs to be constructed from a row in the database. Depending on the xml configuration, the same row might be class A one day, and class B another ...

26. discriminator with type"int"    forum.hibernate.org

Does Hibernate Support it correctly ? Because i've been searching the web for examples and even in the hibernate's site I haven't found nothing with the int type, all example uses string type... I tried this in my table per class mapping XML file.... Code: ...

27. Query using all table columns upon usage of discriminator    forum.hibernate.org

Hi, We have used the Hibernate 3.0.5 mapping tag "discriminator" to map multiple hibernate entities to one single database table which is residing in an Oracle 9.2.0.8.0 database. Unfortunately, there is now a need to make a query spanning multiple hibernate entities in this table. Every HQL query we tried generated an SQL which used one instance of this table per ...

28. Discriminator usages    forum.hibernate.org

Sorry for the multiple posts; Its was done by mistake Following is the most updated question with an example: I want to create an object that holds two lists; the lists are holding the same object type and they are being filtered according to type. For example: I have one class called Person which is connect to one table. The members ...

29. Modifying Discriminator Values    forum.hibernate.org

Well, you can't change the class of an instance, so you can't change a discriminator value. The problem is, that the data base allows this, which is a little tricky. The straight forward way would be to copy the data from the base class into a new instance of the different payment class, delete the old data and insert the new ...

30. Updating the discriminator value    forum.hibernate.org

Hey, I have something similar to the following: abstract class source; public class source_A extends source; public class source_B extends source; With their mapping which is fairly simple, the two classes use the same fields and discriminator values SOURCE_A and SOURCE_B What I want to do is update an object from being a source_A object to being a source_B object. ...

31. adding an index to the discriminator column    forum.hibernate.org

Hello, I have a hibernate setup with 50+ objects. For some tables I have multiple objects in the same table, hence I use a 'discriminator' to distinguish the objects. Now, how can I go about adding an index to the discriminator column? I am using MySQL 5 with InnoDB tables. I have tried... @Entity @Table(name="PersistObject",uniqueConstraints = @UniqueConstraint(columnNames = {"manufacturer", "partNumber"})) @Inheritance(strategy=InheritanceType.SINGLE_TABLE) ...

32. Discriminator value not updated when updating row.    forum.hibernate.org

Hello All, I have a hierarchy of classes that is mapped to a single table, and each of then is identified by the values given in discriminator-value in my hbm file. This is the class level field called "status". What I would like to do is to insert a row with one subclass and update that row with another subclass. I ...

34. Discriminator insert=false with annotation    forum.hibernate.org

Hello, I am facing a problem, I have a discriminator which is a part of a composite ID so i need to put it as insert = false. But I don't find the annotation with insert or insertable property on dicriminator. If somebody have an idea, i will be ver delighted ;-) Thanks, Regards.

36. discriminator as part of natural key    forum.hibernate.org

37. discriminator as part of natural key    forum.hibernate.org

38. Custom discriminator possible?    forum.hibernate.org

Hello. When using the inheritance mapping strategy 'table per class hierarchy', one has to specify the discriminator column and its value for every concrete class to be mapped. I wonder whether it's possible to map such case without using a discriminator column. I mean, one can see it in a more general way: we have the values read from the DB ...

39. Update & Delete sql missing Discriminator Column (help)    forum.hibernate.org

Guys, I am having a strange problem. I have to hibernate objects stored in same table. I can insert the data, but when I try to delete or update a row, hibernate does not include Discriminator Column (DATA_TYPE) in the sql, so I get an exception org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actual row count: 2; expected: ...

40. Hibernate Discriminator Formula Error, MSSQLServer    forum.hibernate.org

Newbie Joined: Sat May 24, 2008 7:34 pm Posts: 5 Hibernate version:3.2.6 MSSQLServer 2005 org.hibernate.dialect.SQLServerDialect org.apache.commons.dbcp.BasicDataSource com.microsoft.sqlserver.jdbc.SQLServerDriver I'm seeing this error when I try to use a discriminator with a formula. "NullableType:main - could not read column value from result set: null; The column name null is not valid" In this case, I'm trying to use a discriminator value from another ...

41. How the Discriminator Works    forum.hibernate.org

I currently have two tables and I am trying to use the discrimintor to get 3 different sets based on the animal_type_code. Table A id (primary key) animal_code animal_type_code The hbm.xml file looks something like ...

42. Help with using a Discriminator    forum.hibernate.org

I currently have two tables and I am trying to use the discrimintor to get 3 different sets based on the animal_type_code. Table A id (primary key) animal_code animal_type_code The hbm.xml file looks something like ...

43. Help with using a Discriminator    forum.hibernate.org

I currently have two tables and I am trying to use the discrimintor to get 3 different sets based on the animal_type_code. Table A id (primary key) animal_code animal_type_code The hbm.xml file looks something like ...

45. Foreign Key as Discriminator    forum.hibernate.org

Hi All, Can a foreign key act as a discriminator? I have got two entity families A & B. Both A & B follow 'table per class hierarchy'. I need to associate A1 (subclass of A) with B1(subclass of B) & A2 (another persistent subclass of A) with B2(another persistent subclass of B. Is it possible or I am just thinking ...

46. projection and discriminator values    forum.hibernate.org

Hello, We are working with version 3.2.3ga I am wondering if it's possible to set a Projection on a property that is subclassed by discriminator? I have these mappings: ...

47. discriminator on two diffrent columns    forum.hibernate.org

hi all, i have just gone through the discrimininator and implmented table per class model of inheritance. here i have used only one column as discrimininator. but can we use discriminator on two diffrent columns?? i got situation like this. i have two columns as follows col1 --- col2 fax --- in fax --- out scan --- done scan --- notdone ...

48. Changing the discriminator    forum.hibernate.org

Hi, I have a class hierarchy. The superclass in Person. It has a subclass Lodger which has a subclass Alumni. When a lodger move out, he becomes an alumni. An alumni can come back and move in again, then he becomes a lodger. I mapped the hierarchy with a discriminator and everythings work fine. When I want to change a lodger ...

49. Several discriminator value for one class    forum.hibernate.org

Author Message Faby Post subject: Several discriminator value for one class Posted: Wed Jan 28, 2009 12:14 pm Newbie Joined: Wed Jan 28, 2009 10:05 am Posts: 3 Hi everybody, I am working with hibernate 3.3, java 1.4 and oracle 10g. I have a main class GlAccount.class, which is abstract, that is extended 2 times : LazyGlBsAccount.class and LazyGlPlAccount.class ...

50. discriminator column    forum.hibernate.org

Hi, i got a question on discriminator columns. Lets say you have a table storing information on cars of different vendors...bmw, chrysler, toyota and this table has a discriminator column vendor_dscr. So if you query a row for a bmw entity hibernate will generate alias names including bmw and a where clause like vendor_dscr="bmw". This behavior leads to unnecessary statements in ...

52. many-to-one discriminator    forum.hibernate.org

I want to map a many-to-one relationship as being the discriminator in an inheritance structure. So basically: employee_type(int) references EMPLOYEE_TYPE(table),employee_type(id),employee_type_name(string). So I want to reference the string value in the EMPLOYEE_TYPE table. only appears to have a column attribute for referencing a single value. Is there a way to get it to reference a many to one relationship resolution of ...

53. discriminator value with a query    forum.hibernate.org

54. Database index on discriminator column    forum.hibernate.org