-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: SchemaExport Generating duplicate columns
PostPosted: Fri Jun 17, 2005 6:38 pm 
Newbie

Joined: Tue Jun 14, 2005 4:06 pm
Posts: 4
Hello,

I am trying to get SchemaExport to dump a schema into HSQLDB when I start an in memory database. However, the sql SchemaExport is sending has duplicate columns (see the sql snippit below). In this case, the roleid column is being declared twice, which hsqldb doesn't like. I doublechecked my mapping document, and I seems to be correct. Any suggestions?

Thanks,

Matt

Hibernate version:
2.1.8

Mapping documents:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by the Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="com.dbsnow.domain.Workorderauthorization"
    table="WORKORDERAUTHORIZATION"
    schema="OPTOOLS"
   mutable="false"
>
        <cache usage="read-only" />

   <id name="userid" column="userid" type="java.lang.Integer">
        <generator class="assigned"/>
   </id>

   <property name="roleid" column="roleid" type="java.lang.Integer" not-null="true"/>

   <set name="users" lazy="true">
        <cache usage="read-only" />
      <key column="USERID"/>
      <one-to-many class="com.dbsnow.domain.Systemuser"/>
   </set>

</class>
</hibernate-mapping>


Code for persistant class:
Code:
package com.dbsnow.domain;

import java.io.Serializable;
import java.util.Set;
import org.apache.commons.lang.builder.ToStringBuilder;


/** @author Hibernate CodeGenerator */
public class Workorderauthorization implements Serializable {

    /** identifier field */
    private Integer userid;

    /** persistent field */
    private Integer roleid;

    /** persistent field */
    private Set users;

    /** full constructor */
    public Workorderauthorization(Integer roleid, Set users) {
        this.roleid = roleid;
        this.users = users;
    }

    /** default constructor */
    public Workorderauthorization() {
    }

    public Integer getUserid() {
        return this.userid;
    }

    public void setUserid(Integer userid) {
        this.userid = userid;
    }

    public Integer getRoleid() {
        return this.roleid;
    }

    public void setRoleid(Integer roleid) {
        this.roleid = roleid;
    }

    public Set getUsers() {
        return this.users;
    }

    public void setUsers(Set users) {
        this.users = users;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("userid", getUserid())
            .toString();
    }

}


Name and version of the database you are using:
HSQLDB 1.8.0 RC12

The generated SQL (show_sql=true):
Code:
create table OPTOOLS.WORKORDERAUTHORIZATION (
   userid integer not null,
   roleid integer not null,
   ROLEID integer,
   primary key (userid)
)


Debug level Hibernate log excerpt:

17:20:32,817 DEBUG SchemaExport:149 - create table OPTOOLS.WORKORDERAUTHORIZATION (
userid integer not null,
roleid integer not null,
ROLEID integer,
primary key (userid)
)
17:20:32,817 ERROR SchemaExport:154 - Unsuccessful: create table OPTOOLS.WORKORDERAUTHORIZATION (userid integer not null, roleid integer not null, ROLEID integer, primary key (userid))
17:20:32,817 ERROR SchemaExport:155 - Column already exists in statement [create table OPTOOLS.WORKORDERAUTHORIZATION (userid integer not null, roleid integer not null, ROLEID integer]
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 6:48 pm 
Newbie

Joined: Tue Jun 14, 2005 4:06 pm
Posts: 4
Never mind. I figured it out. There was another mapping file that setup a one-to-many relationship with this one and ROLEID was all caps in that file. I changed it to all lowercase, and that fixed the problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.