Hi all,

I was just about to investigate this as well, but I have no prostgre dbms 
available.

It probably only requires to set the correct type in 
PostgreDDLGenerator.initDataTypes() similar to this:

public class PostgreDDLGenerator extends 
DBDDLGenerator<DBDatabaseDriverPostgreSQL>
{
    private void initDataTypes()
    {   // Override data types
        DATATYPE_BOOLEAN = "BOOLEAN";
        DATATYPE_CLOB = "TEXT";
        DATATYPE_CLOB = "{ set correct type here!}";
    }

And BTW: the Javadoc comment mentions Oracle. This should be changed to Postgre 
as well.

Best regards
Rainer


> from: Francis De Brabandere [mailto:[email protected]]
> to: [email protected]
> Cc: [email protected]
> re: Re: empire-db possible bug: blob type is not working under
> v2.3
> 
> Hi Jon,
> 
> That's indeed a bug, would you mind creating an issue on
> https://issues.apache.org/jira/browse/EMPIREDB ?
> 
> http://www.postgresql.org/docs/9.2/static/datatype-binary.html
> "The SQL standard defines a different binary string type, called BLOB
> or BINARY LARGE OBJECT. The input format is different from bytea, but
> the provided functions and operators are mostly the same."
> 
> PostgreSQL seems to use "bytea" instead of the iso "blob" type
> 
> I'll try to reproduce this and fix it.
> 
> Thanks,
> Francis
> 
> On 1 June 2012 13:49, Frias Inchausti, Jon <[email protected]>
> wrote:
> >
> > Hello,
> >
> >
> >
> > My name is Jon Frias and I am working under the version 2.3 of empire
> db and posgresql driver.
> >
> >
> >
> > The possible bug I have detected is that, when I am creating a data
> table, I add a new DBTableColumn which data type is BLOB. The code is
> compiling with no problem and no warning appears. However, when the
> database is created by the empire-db generated script, the following
> error occurs:
> >
> >
> >
> >
> >
> > ERROR org.apache.empire.db.DBSQLScript -
> > org.postgresql.util.PSQLException: ERROR: type "blob" does not exist
> >
> >   Position: 178
> >
> > org.postgresql.util.PSQLException: ERROR: type "blob" does not exist
> >
> >   Position: 178
> >
> >       at
> >
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExe
> > cutorImpl.java:2102)
> >
> >       at
> >
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorI
> > mpl.java:1835)
> >
> >       at
> >
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.jav
> > a:257)
> >
> >       at
> >
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2State
> > ment.java:500)
> >
> >       at
> >
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJ
> > dbc2Statement.java:374)
> >
> >       at
> >
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc
> > 2Statement.java:302)
> >
> >       at
> >
> org.apache.empire.db.DBDatabaseDriver.executeSQL(DBDatabaseDriver.java
> > :552)
> >
> >       at org.apache.empire.db.DBSQLScript.run(DBSQLScript.java:120)
> >
> >       at
> >
> com.tecnalia.plantcockpit.orm.testing.database.Database.createDatabase
> > (Database.java:129)
> >
> >       at
> >
> com.tecnalia.plantcockpit.orm.database.DatabaseTest.createDB(DatabaseT
> > est.java:39)
> >
> >       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> >       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >
> >       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > Source)
> >
> >       at java.lang.reflect.Method.invoke(Unknown Source)
> >
> >       at
> >
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkM
> > ethod.java:44)
> >
> >       at
> >
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCall
> > able.java:15)
> >
> >       at
> >
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMet
> > hod.java:41)
> >
> >       at
> >
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMeth
> > od.java:20)
> >
> >       at
> >
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.j
> > ava:28)
> >
> >       at
> >
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.jav
> > a:31)
> >
> >       at
> org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
> >
> >       at
> >
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunn
> > er.java:69)
> >
> >       at
> >
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunn
> > er.java:48)
> >
> >       at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
> >
> >       at
> > org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
> >
> >       at
> > org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
> >
> >       at
> > org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
> >
> >       at
> > org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
> >
> >       at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
> >
> >       at
> >
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4T
> > estReference.java:50)
> >
> >       at
> >
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.
> > java:38)
> >
> >       at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remote
> > TestRunner.java:467)
> >
> >       at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remote
> > TestRunner.java:683)
> >
> >       at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestR
> > unner.java:390)
> >
> >       at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTest
> > Runner.java:197)
> >
> > 344 [main] INFO org.apache.empire.exceptions.EmpireException - An
> > Error occured. Message is: The database operation failed. Native
> error
> > is: ERROR: type "blob" does not exist
> >
> >   Position: 178
> >
> >
> >
> >
> >
> > The code of the datatable which include the datatype BLOB in one
> column is this:
> >
> >
> >
> > public class AddressBook extends DBTable{
> >
> >
> >
> >       /** serial id. */
> >
> >       private static final long serialVersionUID = 1L;
> >
> >
> >
> >       /** The ADDRESS_BOOK_ID. */
> >
> >       public final DBTableColumn ADDRESS_BOOK_ID;
> >
> >
> >
> >       /** The ADDRES s_ id. */
> >
> >       public final DBTableColumn ADDRESS_ID;
> >
> >
> >
> >       /** The LOCATION. */
> >
> >       public final DBTableColumn LOCATION;
> >
> >
> >
> >       public final DBTableColumn INFORMATION;
> >
> >
> >
> >       public AddressBook(DBDatabase db) {
> >
> >             super("address_book", db);
> >
> >
> >
> >             ADDRESS_BOOK_ID = addColumn("address_book_id",
> > DataType.INTEGER, 0, DataMode.AutoGenerated,
> > "address_book_address_book_id_seq");
> >
> >             ADDRESS_ID = addColumn("address_id", DataType.INTEGER, 0,
> > DataMode.NotNull);
> >
> >             LOCATION = addColumn("location", DataType.CHAR, 60,
> > DataMode.NotNull);
> >
> >             INFORMATION = addColumn("information", DataType.BLOB, 0,
> > DataMode.NotNull);
> >
> >
> >
> >             setPrimaryKey(ADDRESS_ID);
> >
> >
> >
> >             addIndex("address_book_pk", true, new DBColumn[] {
> > ADDRESS_BOOK_ID});
> >
> >
> >
> >       }
> >
> >
> >
> > }
> >
> >
> >
> >
> >
> >
> >
> > If you require more details about the source code which can help you
> to understand what is happening, just let me know.
> >
> >
> >
> > Thanks for your time.
> >
> >
> >
> > Best Regards,
> >
> >
> >
> > Jon Frias
> >
> >
> >
> >
> >
> > Jon Frias Inchausti
> >
> > Investigador
> >
> > Researcher
> >
> >
> >
> > UNIDAD DE SISTEMAS INDUSTRIALES /
> >
> > INDUSTRIAL SYSTEMS UNIT
> >
> >
> >
> > División Industria y Transporte /
> >
> > Industry and Transport Division
> >
> >
> >
> > TECNALIA
> >
> > Paseo Mikeletegi 7 - Parque Tecnológico
> >
> > E-20009 Donostia - San Sebastián (Gipuzkoa, Spain)
> >
> > Telf Industry & Transport Division: (+34) 943 105115 or 902 760 002
> >
> > Telf Tecnalia Research & Innovation: (+34) 946 430 850 or 902 760 000
> >
> > Fax: (+34) 946 460 900 or 901 706 009
> >
> > [email protected]
> >
> > www.tecnalia.com
> >
> >
> >
> > Este mensaje puede contener información confidencial o privilegiada.
> Si no eres el destinatario de este mensaje, notifícaselo por favor al
> remitente y bórralo sin reenviarlo o guardarlo dado que está legalmente
> prohibido.
> >
> > Mezu honek daukan informazioa isilpekoa edo pribilegiatua izan
> daiteke. Zuri zuzendua ez badago emaiozu, mesedez,  horren berri
> igorleari eta ezaba ezazu bidali edo gorde gabe, legalki debekatua dago
> eta.
> >
> > This message may contain confidential, proprietary or legally
> privileged information. If you are not the intended recipient of this
> message, please notify it to the sender and delete without resending or
> backing it, as it is legally prohibited.
> >
> > Por favor, piensa en el medio ambiente antes de imprimir este e-mail.
> >
> > Mesedez pentsatu ingurugiroan e-mail hau imprimatu baino lehen.
> >
> > Please, consider the environment before printing this e-mail.
> >
> >

Reply via email to