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] Resolved: (EMPIREDB-60) Cloning of columns is restricted to current class
Date Sun, 05 Sep 2010 13:10:33 GMT

     [ https://issues.apache.org/jira/browse/EMPIREDB-60?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Rainer Döbele resolved EMPIREDB-60.

         Assignee: Rainer Döbele
    Fix Version/s: empire-db-2.0.8-incubating
       Resolution: Fixed

I have resolved this by using getFields() instead of getDeclaredFields().

It has also been a bug that if a field was decalred final then no exception was forwarded
to the caller.
I have added this and also improved the comment.

> 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.8-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.
You can reply to this email to add a comment to the issue online.

View raw message