incubator-empire-db-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francis De Brabandere <franci...@gmail.com>
Subject Re: Scala inter-op issue [Was: Importing XML]
Date Fri, 16 Oct 2009 07:00:35 GMT
Hi Andrew,

Since I'm also interested in scala I think it would be nice to
actually have a scala example in our examples module. Would you be
able and willing to create a scala version of our current simple
example? I suppose we can set up maven to use scala.

I don't have a good enough view on the framework to help you with the
problem. I've mostly been taken care of the maven build. But Rainer
will probably be able to answer your question.

Cheers,
Francis


On Fri, Oct 16, 2009 at 2:07 AM, andrew cooke <acooke.org@gmail.com> wrote:
> Hi,
>
> I just hit quite a serious issue for using Empire DB in Scala which I
> thought I would flag, since you asked.
>
> The clone() method of DBTable (and perhaps any other clone method that
> might be used) requires access to the attributes of an object (so that
> it can copy columns).  Unfortunately in Scala the attributes of an
> instance are always private.  It doesn't appear that way in Scala
> code, because Scala automatically generates matching getters and
> setters (that, simplifying slightly, have the same name as the
> attribute - it sounds odd, but Scala has some unusual syntax that
> makes it work).
>
> This means that cloning fails, because the private attribute generates
> an illegal access exception.  So any query that uses a table twice
> (with different aliases) cannot be expressed in Empire DB (at least, I
> assume this is solved by using DBTable.clone() - I have not yet got it
> to work, for this reason).
>
> I can write my own clone function, I hope, once I learn some more
> about Scala, or I can define my schema in Java.  So this is not a
> deal-breaker for me, but it would make using Empire DB from Scala much
> simpler if the clone method either:
>  1 - checked for the Scala syntax and used the Scala getters/setters or
>  2 - provided a separate method (cloneScala?) that used the Scala
> getters/setters
>
> It is possible to make Scala objects conform to JavaBean standards, so
> another solution would be to use setters that follow that convention,
> but the code would be uglier in Scala and never used from Java, so I
> don't think that is a good idea.
>
> Cheers,
> Andrew
>
>
> 2009/10/13 Francis De Brabandere <francisdb@gmail.com>:
>> Hi andrew,
>>
>> A bit offtopic. Do you use scala a lot? Do you think it is the future
>> for java? Would there be a need for empire-db - scala integration
>> code?
>>
>> Thanks,
>> Francis
>>
>> On Tue, Oct 13, 2009 at 2:17 PM, andrew cooke <acooke.org@gmail.com> wrote:
>>> Sorry, no - my fault.  I was using getRecordData instead of open.  Andrew
>>>
>>> 2009/10/13 andrew cooke <acooke.org@gmail.com>:
>>>> Also, the dump is missing the first element of each table.  I believe
>>>> that is a bug in Empire DB, but I will first try to reproduce it in
>>>> Java and then file a report with a simple example.
>>>
>>
>>
>>
>> --
>> http://www.somatik.be
>> Microsoft gives you windows, Linux gives you the whole house.
>>
>



-- 
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

Mime
View raw message