Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313174 - [Validation] Relax validation error for table defined for non-root entity with single table inheritance
Summary: [Validation] Relax validation error for table defined for non-root entity wit...
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: 2.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Leslie Davis CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-17 11:48 EDT by Karen Butzke CLA
Modified: 2011-05-03 12:05 EDT (History)
1 user (show)

See Also:


Attachments
proposed bug fix patch (4.40 KB, patch)
2011-04-05 14:04 EDT, Leslie Davis CLA
no flags Details | Diff
patch with additional recommended changes (6.93 KB, patch)
2011-04-12 14:39 EDT, Leslie Davis CLA
no flags Details | Diff
patch with additional recommended changes (5.90 KB, patch)
2011-04-14 14:26 EDT, Leslie Davis CLA
neil.hauge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.