-
1. Re: Inheritance: Single Table Strategy
epbernard May 4, 2005 3:47 AM (in response to mduffy_lists)Hum, you're shooting yourself in the foot, but anyway.
Can you show me a simplified case that was working in preview 4 and that does not work anymore? -
2. Re: Inheritance: Single Table Strategy
mduffy_lists May 4, 2005 11:52 AM (in response to mduffy_lists)Please explain the comment, "shooting yourself in the foot".
Is there a better way to do this?
Mike -
3. Re: Inheritance: Single Table Strategy
epbernard May 4, 2005 12:24 PM (in response to mduffy_lists)Please show me your simplified case
-
4. Re: Inheritance: Single Table Strategy
mduffy_lists May 4, 2005 1:01 PM (in response to mduffy_lists)The code is on my home system, but the simple explanation is:
tbl_user contains the columns: firstName, lastName, email, phone, addressId, etc.
there is also a mapping table between tbl_user and tbl_roleType.
The full entity bean, User, contains everything (the composite address object, the collection of role types and all fields).
I want User to inherit from UserDisplayItem which just contains the fields: firstName and lastName. The reason is, I need to display brief user information in a table view and I do not need all the information contained in the full user object.
Shouldn't I be able to mark up both classes with the entity annotations and then just have User extend UserDisplayItem?
Mike -
5. Re: Inheritance: Single Table Strategy
mduffy_lists May 5, 2005 3:50 AM (in response to mduffy_lists)Here is the exception I am getting that I wasn't getting before:
02:45:43,398 ERROR [JDBCExceptionReporter] Column not found message from server: "Unknown column
'user0_.TYPE' in 'where clause'" -
6. Re: Inheritance: Single Table Strategy
epbernard May 5, 2005 2:17 PM (in response to mduffy_lists)You can't do that using inheritance.
In Hibernate Annotations you can mark your extra properties as lazy @Basic(LAZY), but I'm not sure it will work in JBoss EJB3, you'll have to check.
Or preferably you can use a special query
"select new UserDisplayItem(u.firstname, u.lastname) from User u"
or use regular projection.