ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Crocker, Patrick" <patrick.croc...@verizon.com>
Subject RE: Abator and composite keys
Date Fri, 15 Sep 2006 13:18:17 GMT
I once was blind, but now I see.
 
Thank you!
 
- Patrick.

________________________________

From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Thursday, September 14, 2006 2:50 PM
To: user-java@ibatis.apache.org
Subject: Re: Abator and composite keys


You've defined an index, but NOT a primary key.  Abator only looks for
primary key.  So, drop the index then do this:
 
ALTER TABLE MY_TABLE ADD PRIMARY KEY
(MY_KEY_COLUMN_1, MY_KEY_COLUMN_2)
 
Jeff Butler

 
On 9/14/06, Crocker, Patrick <patrick.crocker@verizon.com> wrote: 

	I am using Abator to generate the java model and sql map for a
table
	that has a composite key across three columns.  What I *expect*
to 
	happened is for Abator to generate the record class
(MY_COLUMN_1,
	MY_COLUMN_2) AND the key class (MY_KEY_COLUMN_1,
MY_KEY_COLUMN_2).
	
	However, the only class that is created is the record class
containing
	all the columns (MY_KEY_COLUMN_1, MY_KEY_COLUMN_2, MY_COLUMN_1,
	MY_COLUMN_2).
	
	Are my assumptions wrong here, or is Abator not working
properly?
	
	Here is the setup:
	
	Abator: v1.0.0-238
	Database: Oracle 9.2.6.0
	Table:
	CREATE TABLE MY_TABLE
	(
	MY_KEY_COLUMN_1   VARCHAR2(25 BYTE)         NOT NULL,
	MY_KEY_COLUMN_2   VARCHAR2(25 BYTE)         NOT NULL,
	MY_COLUMN_1       VARCHAR2(25 BYTE)         NOT NULL, 
	MY_COLUMN_2       VARCHAR2(25 BYTE)         NOT NULL,
	)
	
	CREATE UNIQUE INDEX MY_TABLE ON MY_TABLE
	(MY_KEY_COLUMN_1, MY_KEY_COLUMN_2)
	...
	NOPARALLEL;
	
	Generated Record Class:
	
	public class MyTable { 
	
	   private String myKeyColumn1;
	
	   private String myKeyColumn2;
	
	   private String myColumn1;
	
	   private String myColumn2;
	
	       public String getMyColumn1() {
	               return myColumn1; 
	       }
	
	       public void setMyColumn1(String myColumn1) {
	               this.myColumn1 = myColumn1;
	       }
	
	       public String getMyColumn2() {
	               return myColumn2;
	       } 
	
	       public void setMyColumn2(String myColumn2) {
	               this.myColumn2 = myColumn2;
	       }
	
	       public String getMyKeyColumn1() {
	               return myKeyColumn1;
	       }
	
	       public void setMyKeyColumn1(String myKeyColumn1) {
	               this.myKeyColumn1 = myKeyColumn1;
	       }
	
	       public String getMyKeyColumn2() {
	               return myKeyColumn2;
	       }
	
	       public void setMyKeyColumn2(String myKeyColumn2) {
	               this.myKeyColumn2 = myKeyColumn2;
	       }
	}
	
	Thank you,
	
	- Patrick.
	



Mime
View raw message