Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » [SOLVED] MySql Mapping BOOL -> byte must involve in BOOL -> Boolean([SOLVED] Customize type mapping generation)
[SOLVED] MySql Mapping BOOL -> byte must involve in BOOL -> Boolean [message #637483] Fri, 05 November 2010 17:49 Go to next message
Reny is currently offline RenyFriend
Messages: 3
Registered: November 2010
Location: Pisa
Junior Member
Hi all,
I have a type mapping question between Mysql BOOL and Java.
Default iDalì mapping in a byte but I want to map it in a Java Boolean Object.

I have read around in this forum that is possibile to change default behavior by modify an XMI file contained in a jar (about RDB...) .

I have search in my Eclipse Helios about this file but I havn't found it.

My question is: in wich way I can change default mapping about a Mysql type in another Java object than default?

I'm using Eclipse Helios, MySql 5.1.49-1ubuntu8 and java 1.6.0_22-b04

Thanks to all in advance

[Updated on: Mon, 08 November 2010 11:49]

Report message to a moderator

Re: [SOLVED] MySql Mapping BOOL -> byte must involve in BOOL -> Boolean [message #637695 is a reply to message #637483] Mon, 08 November 2010 11:55 Go to previous message
Reny is currently offline RenyFriend
Messages: 3
Registered: November 2010
Location: Pisa
Junior Member
I solved it by myself, this is the solution:

I changed in the jar file /eclipse-jee-helios-linux-gtk/plugins/org.eclipse.datatools. enablement.mysql.dbdefinition_1.0.4.v200906161800.jar
the file /runtime/vendors/MySql_5.1/MySql_5.1.xmi

in this way

<?xml version="1.0" encoding="ASCII"?>
<DBDefinition:DatabaseVendorDefinition xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:DBDefinition=" http:///org/eclipse/datatools/modelbase/dbdefinition/dbdefin ition.ecore" vendor="MySql" version="5.1" maximumIdentifierLength="64" joinSupported="true" tablespacesSupported="false" maximumCommentLength="60" schemaSupported="false" aliasSupported="true" SQLStatementSupported="true">
<!-- patched by Reny for map bit, bool, boolean to -->
<predefinedDataTypeDefinitions xmi:id="TINYINT_UNSIGNED" keyConstraintSupported="true" maximumValue="1" minimumValue="0" primitiveType="SMALLINT" jdbcEnumType="16" javaClassName="java.lang.Boolean">
<defaultValueTypes>NULL</defaultValueTypes>
<name>BIT</name>
<name>BOOL</name>
<name>BOOLEAN</name>
<name>TINYINT UNSIGNED</name>
</predefinedDataTypeDefinitions>
<!--predefinedDataTypeDefinitions xmi:id="BIT_1" keyConstraintSupported="true"
maximumValue="1" minimumValue="0" primitiveType="SMALLINT" jdbcEnumType="-6"
javaClassName="byte">
<defaultValueTypes>0</defaultValueTypes>
<name>BIT</name>
<name>BOOL</name>
<name>BOOLEAN</name>
</predefinedDataTypeDefinitions>
<predefinedDataTypeDefinitions xmi:id="TINYINT_UNSIGNED"
keyConstraintSupported="true" maximumValue="255" minimumValue="0"
primitiveType="SMALLINT" jdbcEnumType="-6" javaClassName="byte">
<defaultValueTypes>NULL</defaultValueTypes>
<name>TINYINT UNSIGNED</name>
</predefinedDataTypeDefinitions-->
<!-- end patched by Reny for map bit, bool, boolean to -->
<predefinedDataTypeDefinitions xmi:id="SMALLINT_UNSIGNED"
keyConstraintSupported="true" maximumValue="65535" minimumValue="0"
primitiveType="SMALLINT" jdbcEnumType="5" javaClassName="int">
<defaultValueTypes>0</defaultValueTypes>
<name>SMALLINT UNSIGNED</name>
</predefinedDataTypeDefinitions>
.....
.....
.....
.....
.....



This solve my problem: it genereats Boolean object, if I put false it write 0 in tinyint, 1 if I save true, and null if I'don't set anything.

[Updated on: Mon, 08 November 2010 11:56]

Report message to a moderator

Previous Topic:Exporting UML profiles from RSA in Ecore format
Next Topic:Generate Entities from Tables not working
Goto Forum:
  


Current Time: Sun Dec 21 03:26:52 GMT 2014

Powered by FUDForum. Page generated in 0.06224 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software