Pojos에 대한 자동 발견 및 데이터베이스 매핑 생성 최대 절전 모드
-
08-07-2019 - |
문제
데이터베이스에서 정보를 수집하여 최대 절전 모드 Pojos를 자동 생성하는 도구가 있습니까?
스키마가 제가 작업하고있는 프로젝트에서 세 번째 또는 네 번째로 변경 된 후 PERL 스크립트를 만들었고 내 스크립트가 다소 조잡하고 필요하기 때문에 저를 위해 할 수있는 도구가 있는지 궁금했습니다. 생성 된 일부 조정 .java
그리고 .hbm.xml
파일.
예를 들어 (내 스크립트가하는 일을 기준으로) 테이블이 있습니다. statement
:
Object_Name Type_Name Base_Type Nulls Identity
------------ --------- --------- ----- --------
id id_int int no yes
id_user id_tiny tinyint no no
value float float no no
나는 다음과 같은 Java를 자극하는 프로그램을 원한다.
package com.some.company.schema;
import java.io.Serializable;
public class Statement implements Serializable {
private static final long serialVersionUID = 1227171190L;
private Integer id;
private User user;
private Float value;
public void setId(Integer id){
this.id = id;
}
public Integer getId(){
return this.id;
}
public void setUser(User user){
this.user = user;
}
public User getUser(){
return this.user;
}
public void setValue(Float value){
this.value = value;
}
public Float getValue(){
return this.value;
}
}
그리고 해당 최대 절전 모드 매핑 파일 :
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.some.company.schema.Statement" table="statement">
<id name="id" column="id">
<generator class="native" />
</id>
<many-to-one name="user" class="com.some.company.schema.User" column="id_user" not-null="true" />
<property name="value" column="value" not-null="true" />
</class>
</hibernate-mapping>
해결책
다른 팁
NetBeans는 최대 절전 모드 나누기/EntitManager와 함께 작동하는 주석 엔티티를 생성하는 데 훌륭한 작업을 수행합니다. 또한 Eclipse에서 최대 절전 모드 도구/JBoss IDE를 사용하여 생성했으며 꽤 잘 작동했습니다.
최대 절전 모드 도구를 참조하십시오
http://www.hibernate.org/hib_docs/tools/reference/en/html_single/
스키마에서 pojos에 이르기까지 확실하지 않지만 확실히 HBM.XML 파일에서 POJOS에 이르기까지.
자동화 된 Maven 플러그인도 Dream Paul을 구축합니다.
제휴하지 않습니다 StackOverflow