Create entity
-
In the menu, select File > New > Entity.
-
At Entity > Name enter the name of the new Entity
-
Click on Finish.
|
Parameters
-
Entity - Settings for the new entity.
-
Data Access Object - Settings for the new DAO (Data Access Obect) for the Entity.
Result
-
Project Management > main-java > domain - The new entity class is generated here.
-
Project Management > main-java > dal - The DAO class for the new entity is generated here.
Example
Generated code for a new Customer entity and CustomerDAO object:
-
Entity
@Entity @DAO(CustomerDAO.class) @Cacheable(true) @Table(name = "Customer") public class Customer implements Serializable { private int id; public Customer() { super(); } @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") public int getId() { return this.id; } public void setId(final int id) { this.id = id; } }
-
DAO
public class CustomerDAO extends JpaDataAccessObject.Default<Customer, Integer> { public final static CustomerDAO INSTANCE = new CustomerDAO(); public CustomerDAO() { super(Customer.class); } }
Entities can easily be edited in Entity Editor
private String name; @Column(name = "`name`") public String getName() { return name; } public void setName(String noname) { this.name = noname; }
|