Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313174

Summary: [Validation] Relax validation error for table defined for non-root entity with single table inheritance
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: GeneralAssignee: Leslie Davis <les.davis>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: neil.hauge
Version: 2.3   
Target Milestone: 3.0 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed bug fix patch
none
patch with additional recommended changes
none
patch with additional recommended changes neil.hauge: iplog+

Description Karen Butzke CLA 2010-05-17 11:48:44 EDT
@Entity
@Table(name="BUYER")
public class Buyer {}

@Entity
@Table(name="BUYER")
public class GoldBuyer extends Buyer {}

In this example we give a validation error on the GoldBuyer @Table annotation: "No table should be defined for non-root entity "GoldBuyer" using single-table inheritance."

We should change the validation logic to check to see if the specified table is the same as the inherited table.  This could be a case where the user just wants to be more explicit rather than relying on defaults.

Workaround is to disable this validation or turn it into a warning in the JPA error/warnings preferences.
Comment 1 Leslie Davis CLA 2011-04-05 14:04:10 EDT
Created attachment 192583 [details]
proposed bug fix patch
Comment 2 Neil Hauge CLA 2011-04-11 17:53:56 EDT
Be careful with the use of "specified" calls here for the child Entity.  Since you are asking for specified qualifiers, these will often be null (when not specified), and will mis-compare with the default values that are retrieved from the root table.  Would be better to use the isSpecifiedInResource() API on table and then use getCatalog, getSchema, getName to ensure that defaults are picked up.


Also, case sensitivity needs to be considered here when comparing defaults against specified values.
Comment 3 Leslie Davis CLA 2011-04-12 14:39:33 EDT
Created attachment 193082 [details]
patch with additional recommended changes

Addition recommended changes, added check for active db connection and compared parent/child db table objects rather than just the names.
Comment 4 Leslie Davis CLA 2011-04-14 14:26:18 EDT
Created attachment 193281 [details]
patch with additional recommended changes
Comment 5 Neil Hauge CLA 2011-04-21 12:52:49 EDT
Patch reviewed, tested, and committed to head.