Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dali-dev] Dali + Postgre SQL

Probably the best place to document your experience is as a comment
in the bug/enhancement I created, 214857. Thanks.
Brian

-----Original Message-----
>From Guilherme Rios <gasrios@xxxxxxxx>
Sent Thu 1/10/2008 9:48 AM
To General Dali EJB ORM developer discussion. <dali-dev@xxxxxxxxxxx>
Subject Re: [dali-dev] Dali + Postgre SQL

Hi Brian,

    Thanks for your reply. FIY, I manually edited the jar file you
mentioned and changed primitiveType for both BIT and BOOL from SMALLINT
to BOOLEAN and that solved the problem, but only after erasing my
~/.eclipse/org.eclipse.platform_3.3.0_1377168364 directory and importing
my JPA project into a new workspace created from a "fresh" eclipse run.
Guess the type mapping is cached somewhere else.
    Considering that until the enhancement request is implemented
automatic entity generation in Dali may result in broken code, I would
like to sugest this workaround to be published somewhere. I could sum up
both your email and mine and write a text explaining the workaround of
you want.

Cheers,

Guilherme

Brian Vosburgh wrote:
> Hello, Guilherme.
> 
> Currently, Dali uses settings in DTP to determine what Java type to use when
> generating entity fields/properties. In this particular situation,
> there are 2 problems:
> 
> 1. The DTP settings for Postgres map the BOOL datatype to the SMALLINT
> "primitive type". (BOOLEAN might be a better candidate, but the purpose
> of "primitive type" is not obvious to me....)
> 
> 2. Dali currently uses this mapping to determine an appropriate Java type
> for a generated field/property. There is a better, but not as obvious,
> mapping we could use, namely "Java class name".
> 
> These mappings are in the file postgresql_8.x.xmi.
> This file is in ./plugins/org.eclipse.datatools.enablement.postgresql.dbdefinition_1.0.0.200706071.jar.
> The BOOL data type has the 2 mappings mentioned above:
>     primitiveType="SMALLINT"
>     javaClassName="java.lang.Boolean"
> 
> I have added an enhancement request to improve this mapping: https://bugs.eclipse.org/bugs/show_bug.cgi?id=214857
> 
> I hope this explains the behavior you are seeing;
> and, hopefully, we can improve it soon.
> Brian
> 
> 
> -----Original Message-----
>>From Guilherme Rios <gasrios@xxxxxxxx>
> Sent Sun 1/6/2008 4:12 PM
> To dali-dev@xxxxxxxxxxx
> Subject [dali-dev] Dali + Postgre SQL
> 
> Hi,
> 
>     I tried to use the "Generate Entities..." menu option to create and
> map tables from Postgres using two different JPA implementations (Apache
> OpenJpa and Hibernate JPA) and noticed database boolean fields were
> mapped to either long (Dali 0.5) or short (Dali 1.0) primitive java data
> types.  When I try to use the generated code to load info from the
> database, it would fail converting Postgres boolean to either long or
> short. Some tests with Postgres driver convincingly showed it correctly
> informs the preferred data type to be used in this case is
> java.lang.Boolean. A quick - and therefore prone to mistakes - look
> through EJB 3.0 spec found nothing sugesting this convertion from
> boolean to either long or short to be mandatory.
>     Before deciding to post here, I read WTP's FAQ, did lots of
> websearching and checked Eclipse Bugzilla for references to similar
> problems, nothing of which helped. If I missed something and this post
> does not belong here, I apologize and will gladly take RTFM for an
> answer, provided someone points me to the FM :). However, I really would
> like to use Dali for my next project and having to manually edit
> generated files might be rather problematic to us. Can anyone help
> please? Is this really a bug or did I miss something?
> 
> Thanks in advance,
> 
> Guilherme
> _______________________________________________
> dali-dev mailing list
> dali-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dali-dev
> 
> 
> _______________________________________________
> dali-dev mailing list
> dali-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dali-dev
> 
> 

-- 
One of us
Can't erase the past to
change who he would be

Anthrax - Room For One More
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev




Back to the top