metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (METAMODEL-131) Create table with composite primary key gives error.
Date Mon, 06 Apr 2015 18:02:12 GMT


ASF GitHub Bot commented on METAMODEL-131:

Github user narahari92 commented on the pull request:
    Yes, what you said is true. But the reason I thought of above fix is, all the databases
METAMODEL supports have a same syntax for creating table. So It would be unnecessary overhead
writing like QueryRewriter(Different databases have slightly different Query syntax). 
    Is there any such database with different create table syntax?

> Create table with composite primary key gives error.
> ----------------------------------------------------
>                 Key: METAMODEL-131
>                 URL:
>             Project: Apache MetaModel
>          Issue Type: Bug
>            Reporter: Hosur Narahari
> Creating table with primary key is not possible since while generating sql we add "PRIMARY
KEY" keyword to each column which results in error in case of composite primary keys. Below
is the code.
> context.executeUpdate(new UpdateScript() {
> 			@Override
> 			public void run(UpdateCallback callback) {
> 				callback.createTable("amass", "test").
> 				withColumn("id").ofType(ColumnType.INTEGER).ofSize(16).asPrimaryKey()
> 				.withColumn("name").ofType(ColumnType.VARCHAR).ofSize(255).asPrimaryKey()
> 				.execute();
> 			}
> 		});
> I am using mysql. Am I using it in the wrong way?

This message was sent by Atlassian JIRA

View raw message