You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "Kasper Sørensen (JIRA)" <ji...@apache.org> on 2015/01/27 18:53:34 UTC

[jira] [Closed] (METAMODEL-108) How to set composite primary key?

     [ https://issues.apache.org/jira/browse/METAMODEL-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kasper Sørensen closed METAMODEL-108.
-------------------------------------
    Resolution: Invalid
      Assignee: Kasper Sørensen

This is not really something to report as a bug IMO ... It's simply a question - please post those to the mailing list instead of posting it as a bug (that suggests that there is an issue in the project, not that you have a question).

To quickly address your quesition: You can add the .asPrimaryKey() method to multiple of your column definitions. That way you get a composite primary key. If you have follow-up questions or such, please post to the dev@metamodel.apache.org mailing list.

> How to set composite primary key?
> ---------------------------------
>
>                 Key: METAMODEL-108
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-108
>             Project: Apache MetaModel
>          Issue Type: Bug
>         Environment: ubuntu, java 1.7, maven, org.eobjects.metamodel version 3.4.7
>            Reporter: Ashish Pancholi
>            Assignee: Kasper Sørensen
>
> I want to create a database-table using composite primary key in Java Apache MetaModel.
> I am creating database-table using below code :
> org.eobjects.metamodel.create.TableCreationBuilder tableCreator;
> //Getting TableCreater object from schema and table name.
> tableCreator.withColumn("id").asPrimaryKey();
> tableCreator.withColumn("name");
> tableCreator.withColumn("address");
> tableCreator.withColumn("phone");
> java.io.Serializable.Table table = tableCreator.execute()
> It is working fine for me. and set "id" as primary key. But I want to set composite primary key "id and name" How can I do this?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)