You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Ken Weiner <kw...@gmail.com> on 2006/04/24 09:22:29 UTC

problem adding unique element

I am trying to set a column as unique, but when I add a <unique>
element to <table>, the element gets added as if it were a column, and
I get the following error:

org.apache.ddlutils.model.ModelException: The column nr. 8 in table
users has no type
	at org.apache.ddlutils.model.Database.initialize(Database.java:301)
	at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:207)
        ....

My schema XML looks like this:

<database name="myDB">
    <table name="users">
        <column name="id" type="INTEGER" primaryKey="true"
autoIncrement="true" required="true"/>
        <column name="user_name" type="VARCHAR" size="255" required="true"/>
        <unique name="userNameUnique">
            <unique-column name="user_name"/>
        </unique>
    </table>
</database>

Am I doing something wrong?  I can't understand why the model ends up
containing 3 columns instead of 2.  I verified this in the debugger.

-Ken

Re: problem adding unique element

Posted by Ken Weiner <kw...@gmail.com>.
Thank you.  I was using the version of commons-betwixt listed in the
pom.xml which was 0.7.  I changed it to 0.8-dev to match the version
of commons-betwixt.jar in the lib directory and everything started
working.  I filed an issue DDLUTILS-103 to update the pom.xml.

On 4/25/06, Thomas Dudziak <to...@gmail.com> wrote:
> On 4/24/06, Ken Weiner <kw...@gmail.com> wrote:
> > I am trying to set a column as unique, but when I add a <unique>
> > element to <table>, the element gets added as if it were a column, and
> > I get the following error:
> >
> > org.apache.ddlutils.model.ModelException: The column nr. 8 in table
> > users has no type
> >         at org.apache.ddlutils.model.Database.initialize(Database.java:301)
> >         at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:207)
> >         ....
>
> This error was posted before on this mailing list. The solution back
> then, I think, was to update to the newest version of DdlUtils (esp.
> the commons-betwixt library that DdlUtils uses). You should perhaps
> also add the DTD reference:
>
> <?xml version="1.0"?>
> <!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">
>
> and see if that works.
>
> Tom
>

Re: problem adding unique element

Posted by Thomas Dudziak <to...@gmail.com>.
On 4/24/06, Ken Weiner <kw...@gmail.com> wrote:
> I am trying to set a column as unique, but when I add a <unique>
> element to <table>, the element gets added as if it were a column, and
> I get the following error:
>
> org.apache.ddlutils.model.ModelException: The column nr. 8 in table
> users has no type
>         at org.apache.ddlutils.model.Database.initialize(Database.java:301)
>         at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:207)
>         ....

This error was posted before on this mailing list. The solution back
then, I think, was to update to the newest version of DdlUtils (esp.
the commons-betwixt library that DdlUtils uses). You should perhaps
also add the DTD reference:

<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">

and see if that works.

Tom