empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Döbele (JIRA) <empire-db-...@incubator.apache.org>
Subject [jira] [Closed] (EMPIREDB-60) Cloning of columns is restricted to current class
Date Mon, 04 Feb 2013 14:10:13 GMT

     [ 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
> The cloning of columns in DBTable runs through the fields of the current class (Line
>             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

View raw message