You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by "Rainer Döbele (JIRA)" <em...@incubator.apache.org> on 2013/02/04 15:10:13 UTC
[jira] [Closed] (EMPIREDB-60) Cloning of columns is restricted to
current class
[ https://issues.apache.org/jira/browse/EMPIREDB-60?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rainer Döbele closed EMPIREDB-60.
---------------------------------
Cleanup of unclosed issues.
> Cloning of columns is restricted to current class
> -------------------------------------------------
>
> Key: EMPIREDB-60
> URL: https://issues.apache.org/jira/browse/EMPIREDB-60
> Project: Empire-DB
> Issue Type: Bug
> Components: Core
> Affects Versions: empire-db-2.0.5-incubating
> Reporter: andrew cooke
> Assignee: Rainer Döbele
> Fix For: empire-db-2.0.7-incubating
>
>
> [First, I must admit that this may be some weirdness related to Scala, but I don't see how]
> The cloning of columns in DBTable runs through the fields of the current class (Line 104):
> Field[] fields = getClass().getDeclaredFields();
> As far as I can see, this only lists fields for the current class (Javadoc for Java class, see difference between getDeclaredFields and getFields)
> Now maybe I am doing some evil coupling between database and the classes I am using to model my domain, but I am using tables with a class hierarchy. So, for example, a base class has an ID column, then a subclass might add a VALUE column, etc. This lets me place methods related to commonly occurring columns in base classes.
> Unfortunately, cloning tables then fails to work as expected (and I need cloning of tables so that I can make queries that join a class with "itself").
> The solution is to put the cloning code in a loop something like:
> Class clazz = getClass()
> while (clazz != DBTable.class) {
> ... cloning here
> clazz = clazz.getSuperClass()
> }
> Which I have done (I already need to override this clone method to use Scala accessors) and which fixes my problems.
> Apologies if I have misunderstood or am misusing the library.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira