DB Importer 2.0
Categories:
DB Importer is an Eclipse plug-in that generates JPA classes for an existing database. It is free for non-commercial use.
Version 2.0 has a new user interface and adds possibility to configure the generated code in the DB Importer editor.
A script can be used to configure many values at once or for more advanced configurations. For instance:
- Filter which tables to import.
- Determine whether to generate relations for foreign keys.
- Control generation of many-to-many relations from join tables.
- Configure class and variable names. For instance, a table name like "tb_person_account" can be converted to a class name "PersonAccount".
- Generate annotations such as @GeneratedId, @Version, etc.
- Check database design rules.
Here are some examples of code that can be generated:
Generate @Version annotation on all fields with name "version"
@Version private long version;
Generate @GeneratedValue(strategy=GenerationType.AUTO) on all PK fields
@Id @GeneratedValue(strategy=GenerationType.AUTO) private long id;
Convert all tinyint SQL columns to Boolean or boolean Java types
private boolean b;
Let some classes implement a certain interface
@Entity class Person implements PersistentObject
Generate both relation and attribute for a field
This can be useful with frameworks such as SmartGWT, which don't handle JPA relations very well.
@ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="person_id", nullable=false, insertable=false, updatable=false) private Person person; @Column(name="person_id") private long personId;
Generate ordered lists for some collections
@OneToMany(mappedBy="messageList", fetch=FetchType.LAZY) @OrderBy(value="sortOrder") private Listmessages = new ArrayList ();
Generate enum types instead of int for some fields
@Column(name="status", length=10) private Status status;
Generate metadata
public interface PersonMetadata {
String ID = "id";
String NAME = "name";
}
Import unique constraints
@Entity
@Table(name="messages", uniqueConstraints={
@UniqueConstraint(columnNames={"unique_code"})
} )
See our home page for how to do this in practice.
Additional Details
- Version Number: 2.0
- Eclipse Versions: 3.5, 3.6
- Organization: Object Generation
- Date Created: 07/12/2010
- Date Updated: 18/05/2011
- Development Status: Production/Stable
- License: Free for non-commerical use
- Submitted by: Lars Høidahl
- This listing has been installed 24 times in the last 30 days.

