dimanche 28 juin 2015

Java entity classes from my proprietary database?

Friends i have one database which maintain schema files in JSON format but it doesn't support JDBC connectivity so i can't use existing netbeans feature "entity class from database" this proprietary database gives me following table schema

{
"uid":{
  "auto-define":"none",
  "name":"uid",
  "index":"unique",
  "type":{
     "length":-1,
     "type":"STRING"
  }
},
"createdAt":{
  "auto-define":"none",
  "name":"createdAt",
  "index":"none",
  "type":{
     "type":"LONG"
  }
},
"lastLogin":{
  "auto-define":"none",
  "name":"lastLogin",
  "index":"none",
  "type":{
     "type":"LONG"
  }
},
"password":{
  "auto-define":"none",
  "name":"password",
  "index":"none",
  "type":{
     "length":-1,
     "type":"STRING"
  }
},
"blocked":{
  "auto-define":"none",
  "name":"blocked",
  "index":"none",
  "type":{
     "type":"BOOLEAN"
  }
},
"replication-type":"distributed",
"replication-factor":1,
"email":{
  "auto-define":"none",
  "name":"email",
  "index":"btree",
  "type":{
     "length":-1,
     "type":"STRING"
  }
},
"primary":"uid",
"network":{
  "auto-define":"none",
  "name":"network",
  "index":"none",
  "type":{
     "length":-1,
     "type":"STRING"
  }
 }
}

so from above schema (JSON) i want the entity class like

@Entity
public class User extends CloudStorage {
@Primary
private String id;
private String name;
private String email;

public String getId() {
    return id;
}

public void setId(String id) {
    this.id = id;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getEmail() {
    return email;
}

public void setEmail(String email) {
    this.email = email;
}
}

please help me, i want to develop a NetBeans plugin which will get all the table schema (JSON) and gives the ability to select the table and generate entity classes.

Aucun commentaire:

Enregistrer un commentaire