Testing JPA/Hibernate entities using DBUnit

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Testing JPA/Hibernate entities using DBUnit

ziggy25

I've got some problems with some entities specifically with the use of JPA/Hibernate and DBUNIT.
I came across this error when i tried to build the project.

    Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.221 sec <<< FAILURE!
    readDocumentById(com.bt.msm.ds.facade.DataServicesFacadeTest)  Time elapsed: 2.043 sec  <<< ERROR!
    org.dbunit.dataset.NoSuchColumnException: CONTENTDOCUMENT.ID -  (Non-uppercase input column: ID) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.
        at org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:128)
        at org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:89)
        at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:140)
        at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
  
   
The error disappears if the configuration properties are as follows

    username : usera
    password : usera
    schema   : usera
    dbunit version : 2.4.2

The error reappears if the configuration properties are as follows

    username : usera
    pasword : usera
    schema :  schemab
    dbunit version > 2.4.2 (e.g. 2.4.4)

It looks like if the shema name is the same as the username and the dbunit version is 2.4.2 then it works. If the schema name is not the same as the username and the dbunit version is any version greater than 2.4.2 ( i tried 2.4.3 and 2.4.4) then the error occurs.

Here are some details

Table DDL

    CREATE TABLE CONTENTDOCUMENT (
      ID bigint(20) NOT NULL AUTO_INCREMENT,
      CONTENT varchar(255) DEFAULT NULL,
      PRIMARY KEY (`ID`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8

Database version:

 `MySql 5.5.17 MySQL Community Server (GPL)`

JPA/Hibernate Entity  (summary) -

    @Entity
    @Indexed
    @Table(name="CONTENTDOCUMENT")
   
    public class ContentDocument{
        @Id
        @GeneratedValue(strategy=GenerationType.IDENTITY)
        @Column(name="ID")
        public Long getId() {
            return id;
        }
       
        @Column(name="CONTENT")
        public String getContent() {
            return content;
        }
    }

DBunit dataset

    <dataset>
        <CONTENTDOCUMENT ID="1" CONTENT="TestContent1"/>
        <CONTENTDOCUMENT ID="2" CONTENT="TestContent2" />   
    </dataset>

Any clues?



   
 




------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Testing JPA/Hibernate entities using DBUnit

Jeff Jensen-2
Please try 2.4.9-SNAPSHOT (you will have to build from source;
snapshots are not currently pre-built).
I believe commit 1209 fixes the problem you are experiencing:

r1209 | jeffjensen | 2010-11-30 23:33:02 -0600 (Tue, 30 Nov 2010) | 1 line
Changed paths:
   M /trunk/dbunit/src/main/java/org/dbunit/database/AbstractDatabaseConnection.java

Add schema name, if specified, to table name in query in
AbstractDatabaseConnection.createTable().


On Fri, Jan 20, 2012 at 9:02 AM, Ziggy <[hidden email]> wrote:

>
> I've got some problems with some entities specifically with the use of
> JPA/Hibernate and DBUNIT.
> I came across this error when i tried to build the project.
>
>     Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.221
> sec <<< FAILURE!
>     readDocumentById(com.bt.msm.ds.facade.DataServicesFacadeTest)  Time
> elapsed: 2.043 sec  <<< ERROR!
>     org.dbunit.dataset.NoSuchColumnException: CONTENTDOCUMENT.ID -
> (Non-uppercase input column: ID) in ColumnNameToIndexes cache map. Note that
> the map's column names are NOT case sensitive.
>         at
> org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:128)
>         at
> org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:89)
>         at
> org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:140)
>         at
> org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
>
>
> The error disappears if the configuration properties are as follows
>
>     username : usera
>     password : usera
>     schema   : usera
>     dbunit version : 2.4.2
>
> The error reappears if the configuration properties are as follows
>
>     username : usera
>     pasword : usera
>     schema :  schemab
>     dbunit version > 2.4.2 (e.g. 2.4.4)
>
> It looks like if the shema name is the same as the username and the dbunit
> version is 2.4.2 then it works. If the schema name is not the same as the
> username and the dbunit version is any version greater than 2.4.2 ( i tried
> 2.4.3 and 2.4.4) then the error occurs.
>
> Here are some details
>
> Table DDL
>
>     CREATE TABLE CONTENTDOCUMENT (
>       ID bigint(20) NOT NULL AUTO_INCREMENT,
>       CONTENT varchar(255) DEFAULT NULL,
>       PRIMARY KEY (`ID`)
>     ) ENGINE=MyISAM DEFAULT CHARSET=utf8
>
> Database version:
>
>  `MySql 5.5.17 MySQL Community Server (GPL)`
>
> JPA/Hibernate Entity  (summary) -
>
>     @Entity
>     @Indexed
>     @Table(name="CONTENTDOCUMENT")
>
>     public class ContentDocument{
>         @Id
>         @GeneratedValue(strategy=GenerationType.IDENTITY)
>         @Column(name="ID")
>         public Long getId() {
>             return id;
>         }
>
>         @Column(name="CONTENT")
>         public String getContent() {
>             return content;
>         }
>     }
>
> DBunit dataset
>
>     <dataset>
>         <CONTENTDOCUMENT ID="1" CONTENT="TestContent1"/>
>         <CONTENTDOCUMENT ID="2" CONTENT="TestContent2" />
>     </dataset>
>
> Any clues?
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Testing JPA/Hibernate entities using DBUnit

ziggy25
I dont really know how to build it from source. Is there any other way i can temporarily resolve the issue for now?

Thanks

On Sun, Jan 22, 2012 at 12:49 AM, Jeff Jensen <[hidden email]> wrote:
Please try 2.4.9-SNAPSHOT (you will have to build from source;
snapshots are not currently pre-built).
I believe commit 1209 fixes the problem you are experiencing:

r1209 | jeffjensen | 2010-11-30 23:33:02 -0600 (Tue, 30 Nov 2010) | 1 line
Changed paths:
  M /trunk/dbunit/src/main/java/org/dbunit/database/AbstractDatabaseConnection.java

Add schema name, if specified, to table name in query in
AbstractDatabaseConnection.createTable().


On Fri, Jan 20, 2012 at 9:02 AM, Ziggy <[hidden email]> wrote:
>
> I've got some problems with some entities specifically with the use of
> JPA/Hibernate and DBUNIT.
> I came across this error when i tried to build the project.
>
>     Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.221
> sec <<< FAILURE!
>     readDocumentById(com.bt.msm.ds.facade.DataServicesFacadeTest)  Time
> elapsed: 2.043 sec  <<< ERROR!
>     org.dbunit.dataset.NoSuchColumnException: CONTENTDOCUMENT.ID -
> (Non-uppercase input column: ID) in ColumnNameToIndexes cache map. Note that
> the map's column names are NOT case sensitive.
>         at
> org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:128)
>         at
> org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:89)
>         at
> org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:140)
>         at
> org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
>
>
> The error disappears if the configuration properties are as follows
>
>     username : usera
>     password : usera
>     schema   : usera
>     dbunit version : 2.4.2
>
> The error reappears if the configuration properties are as follows
>
>     username : usera
>     pasword : usera
>     schema :  schemab
>     dbunit version > 2.4.2 (e.g. 2.4.4)
>
> It looks like if the shema name is the same as the username and the dbunit
> version is 2.4.2 then it works. If the schema name is not the same as the
> username and the dbunit version is any version greater than 2.4.2 ( i tried
> 2.4.3 and 2.4.4) then the error occurs.
>
> Here are some details
>
> Table DDL
>
>     CREATE TABLE CONTENTDOCUMENT (
>       ID bigint(20) NOT NULL AUTO_INCREMENT,
>       CONTENT varchar(255) DEFAULT NULL,
>       PRIMARY KEY (`ID`)
>     ) ENGINE=MyISAM DEFAULT CHARSET=utf8
>
> Database version:
>
>  `MySql 5.5.17 MySQL Community Server (GPL)`
>
> JPA/Hibernate Entity  (summary) -
>
>     @Entity
>     @Indexed
>     @Table(name="CONTENTDOCUMENT")
>
>     public class ContentDocument{
>         @Id
>         @GeneratedValue(strategy=GenerationType.IDENTITY)
>         @Column(name="ID")
>         public Long getId() {
>             return id;
>         }
>
>         @Column(name="CONTENT")
>         public String getContent() {
>             return content;
>         }
>     }
>
> DBunit dataset
>
>     <dataset>
>         <CONTENTDOCUMENT ID="1" CONTENT="TestContent1"/>
>         <CONTENTDOCUMENT ID="2" CONTENT="TestContent2" />
>     </dataset>
>
> Any clues?
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Testing JPA/Hibernate entities using DBUnit

ziggy25
How can i download version 2.4.9-SNAPSHOT? I cant see it in dbunit.svn.sourceforge.net/viewvc/dbunit/tags/


On Mon, Jan 23, 2012 at 7:37 AM, Ziggy <[hidden email]> wrote:
I dont really know how to build it from source. Is there any other way i can temporarily resolve the issue for now?

Thanks


On Sun, Jan 22, 2012 at 12:49 AM, Jeff Jensen <[hidden email]> wrote:
Please try 2.4.9-SNAPSHOT (you will have to build from source;
snapshots are not currently pre-built).
I believe commit 1209 fixes the problem you are experiencing:

r1209 | jeffjensen | 2010-11-30 23:33:02 -0600 (Tue, 30 Nov 2010) | 1 line
Changed paths:
  M /trunk/dbunit/src/main/java/org/dbunit/database/AbstractDatabaseConnection.java

Add schema name, if specified, to table name in query in
AbstractDatabaseConnection.createTable().


On Fri, Jan 20, 2012 at 9:02 AM, Ziggy <[hidden email]> wrote:
>
> I've got some problems with some entities specifically with the use of
> JPA/Hibernate and DBUNIT.
> I came across this error when i tried to build the project.
>
>     Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.221
> sec <<< FAILURE!
>     readDocumentById(com.bt.msm.ds.facade.DataServicesFacadeTest)  Time
> elapsed: 2.043 sec  <<< ERROR!
>     org.dbunit.dataset.NoSuchColumnException: CONTENTDOCUMENT.ID -
> (Non-uppercase input column: ID) in ColumnNameToIndexes cache map. Note that
> the map's column names are NOT case sensitive.
>         at
> org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:128)
>         at
> org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:89)
>         at
> org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:140)
>         at
> org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
>
>
> The error disappears if the configuration properties are as follows
>
>     username : usera
>     password : usera
>     schema   : usera
>     dbunit version : 2.4.2
>
> The error reappears if the configuration properties are as follows
>
>     username : usera
>     pasword : usera
>     schema :  schemab
>     dbunit version > 2.4.2 (e.g. 2.4.4)
>
> It looks like if the shema name is the same as the username and the dbunit
> version is 2.4.2 then it works. If the schema name is not the same as the
> username and the dbunit version is any version greater than 2.4.2 ( i tried
> 2.4.3 and 2.4.4) then the error occurs.
>
> Here are some details
>
> Table DDL
>
>     CREATE TABLE CONTENTDOCUMENT (
>       ID bigint(20) NOT NULL AUTO_INCREMENT,
>       CONTENT varchar(255) DEFAULT NULL,
>       PRIMARY KEY (`ID`)
>     ) ENGINE=MyISAM DEFAULT CHARSET=utf8
>
> Database version:
>
>  `MySql 5.5.17 MySQL Community Server (GPL)`
>
> JPA/Hibernate Entity  (summary) -
>
>     @Entity
>     @Indexed
>     @Table(name="CONTENTDOCUMENT")
>
>     public class ContentDocument{
>         @Id
>         @GeneratedValue(strategy=GenerationType.IDENTITY)
>         @Column(name="ID")
>         public Long getId() {
>             return id;
>         }
>
>         @Column(name="CONTENT")
>         public String getContent() {
>             return content;
>         }
>     }
>
> DBunit dataset
>
>     <dataset>
>         <CONTENTDOCUMENT ID="1" CONTENT="TestContent1"/>
>         <CONTENTDOCUMENT ID="2" CONTENT="TestContent2" />
>     </dataset>
>
> Any clues?
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user



------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Testing JPA/Hibernate entities using DBUnit

Jeff Jensen-2

There is no tag for it.  Use the latest code from source/trunk/head.

On Jan 23, 2012 2:09 AM, "Ziggy" <[hidden email]> wrote:
How can i download version 2.4.9-SNAPSHOT? I cant see it in dbunit.svn.sourceforge.net/viewvc/dbunit/tags/


On Mon, Jan 23, 2012 at 7:37 AM, Ziggy <[hidden email]> wrote:
I dont really know how to build it from source. Is there any other way i can temporarily resolve the issue for now?

Thanks


On Sun, Jan 22, 2012 at 12:49 AM, Jeff Jensen <[hidden email]> wrote:
Please try 2.4.9-SNAPSHOT (you will have to build from source;
snapshots are not currently pre-built).
I believe commit 1209 fixes the problem you are experiencing:

r1209 | jeffjensen | 2010-11-30 23:33:02 -0600 (Tue, 30 Nov 2010) | 1 line
Changed paths:
  M /trunk/dbunit/src/main/java/org/dbunit/database/AbstractDatabaseConnection.java

Add schema name, if specified, to table name in query in
AbstractDatabaseConnection.createTable().


On Fri, Jan 20, 2012 at 9:02 AM, Ziggy <[hidden email]> wrote:
>
> I've got some problems with some entities specifically with the use of
> JPA/Hibernate and DBUNIT.
> I came across this error when i tried to build the project.
>
>     Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.221
> sec <<< FAILURE!
>     readDocumentById(com.bt.msm.ds.facade.DataServicesFacadeTest)  Time
> elapsed: 2.043 sec  <<< ERROR!
>     org.dbunit.dataset.NoSuchColumnException: CONTENTDOCUMENT.ID -
> (Non-uppercase input column: ID) in ColumnNameToIndexes cache map. Note that
> the map's column names are NOT case sensitive.
>         at
> org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:128)
>         at
> org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:89)
>         at
> org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:140)
>         at
> org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
>
>
> The error disappears if the configuration properties are as follows
>
>     username : usera
>     password : usera
>     schema   : usera
>     dbunit version : 2.4.2
>
> The error reappears if the configuration properties are as follows
>
>     username : usera
>     pasword : usera
>     schema :  schemab
>     dbunit version > 2.4.2 (e.g. 2.4.4)
>
> It looks like if the shema name is the same as the username and the dbunit
> version is 2.4.2 then it works. If the schema name is not the same as the
> username and the dbunit version is any version greater than 2.4.2 ( i tried
> 2.4.3 and 2.4.4) then the error occurs.
>
> Here are some details
>
> Table DDL
>
>     CREATE TABLE CONTENTDOCUMENT (
>       ID bigint(20) NOT NULL AUTO_INCREMENT,
>       CONTENT varchar(255) DEFAULT NULL,
>       PRIMARY KEY (`ID`)
>     ) ENGINE=MyISAM DEFAULT CHARSET=utf8
>
> Database version:
>
>  `MySql 5.5.17 MySQL Community Server (GPL)`
>
> JPA/Hibernate Entity  (summary) -
>
>     @Entity
>     @Indexed
>     @Table(name="CONTENTDOCUMENT")
>
>     public class ContentDocument{
>         @Id
>         @GeneratedValue(strategy=GenerationType.IDENTITY)
>         @Column(name="ID")
>         public Long getId() {
>             return id;
>         }
>
>         @Column(name="CONTENT")
>         public String getContent() {
>             return content;
>         }
>     }
>
> DBunit dataset
>
>     <dataset>
>         <CONTENTDOCUMENT ID="1" CONTENT="TestContent1"/>
>         <CONTENTDOCUMENT ID="2" CONTENT="TestContent2" />
>     </dataset>
>
> Any clues?
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user



------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user