Skip to main content

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

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




Back to the top