norm icon indicating copy to clipboard operation
norm copied to clipboard

Is array supported?

Open zhaodice opened this issue 3 years ago • 2 comments

Example:

@Entity
@Table(name="groups")
public class GroupData {

    @Id
    @GeneratedValue
    public long id;

    public long groupId;

    public String groupName;

    public String[] test;

}

zhaodice avatar Jul 08 '22 02:07 zhaodice

What error message do you get when you try it?

ccleve avatar Jul 28 '22 18:07 ccleve

What error message do you get when you try it?

I am sorry for reply you too late, no error. but it will create wrong table. example:

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="groups")
public class GroupData {

    @Id
    @GeneratedValue
    public long id;

    public long groupId;

    public String groupName;

    public String[] test;

}
import com.dieselpoint.norm.Database;

public class run {
    public static void main(String[] args) {
        try {
            Database database = new Database();
            database.setJdbcUrl("jdbc:h2:/tmp/test;database_to_upper=false;TRACE_LEVEL_FILE=0;TRACE_LEVEL_SYSTEM_OUT=0;DB_CLOSE_DELAY=20;DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=true");
            database.setUser("sa");
            database.setPassword("");
            database.createTable(GroupData.class);
        } catch (Throwable e) {
            e.printStackTrace();
        }

    }
}

it will do this:

create table groups (id bigint auto_increment,groupId bigint,groupName varchar(255),test varchar(255), primary key (id))

test = varchar(255) ? it is array! not text... @ccleve

zhaodice avatar Dec 01 '22 16:12 zhaodice