Я пытаюсь сгенерировать сущности из базы данных SQL Server и сгенерировать указанные таблицы в базу данных MySQL. Я успешно сгенерировал сущности с помощью инструментов JPA, и теперь у меня есть сущности, подобные этой:
@Entity
//It was originally the @Table annotation, I changed it just to see if
//it would work like this
@TableGenerator(name="AGENCY",schema="amex_digital_test_dev")
@NamedQuery(name="Agency.findAll", query="SELECT a FROM Agency a")
public class Agency implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(unique=true, nullable=false)
private int IDAgency;
@Column(name="Channel_Code")
private String channel_Code;
@Column(name="CodiceOAM")
private String codiceOAM;
@Column(name="DistributionList")
private String distributionList;
@Column(name="IsSimpleSignature")
private boolean isSimpleSignature;
@Column(name="Name", nullable=false)
private String name;
public Agency() {
}
public int getIDAgency() {
return this.IDAgency;
}
public void setIDAgency(int IDAgency) {
this.IDAgency = IDAgency;
}
public String getChannel_Code() {
return this.channel_Code;
}
public void setChannel_Code(String channel_Code) {
this.channel_Code = channel_Code;
}
public String getCodiceOAM() {
return this.codiceOAM;
}
public void setCodiceOAM(String codiceOAM) {
this.codiceOAM = codiceOAM;
}
public String getDistributionList() {
return this.distributionList;
}
public void setDistributionList(String distributionList) {
this.distributionList = distributionList;
}
public boolean getIsSimpleSignature() {
return this.isSimpleSignature;
}
public void setIsSimpleSignature(boolean isSimpleSignature) {
this.isSimpleSignature = isSimpleSignature;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
My persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns /persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="JPAAmex" transaction-type="RESOURCE_LOCAL">
<class>com.olsa.amex.entities.Agency</class>
<class>com.olsa.amex.entities.AgencyRegionView</class>
<class>com.olsa.amex.entities.Agent</class>
<class>com.olsa.amex.entities.AgentAgencyRegionAndSubRegionRel</class>
<class>com.olsa.amex.entities.AgentAgencyRegionAndSubRegionRelBackUp</class>
<class>com.olsa.amex.entities.AgentGroup</class>
<class>com.olsa.amex.entities.AgentsInfo</class>
<class>com.olsa.amex.entities.AmexStatoPriorita</class>
<class>com.olsa.amex.entities.AmexXEROXField</class>
<class>com.olsa.amex.entities.AmexXEROXSection</class>
<class>com.olsa.amex.entities.Application</class>
<class>com.olsa.amex.entities.ApplicationField</class>
<class>com.olsa.amex.entities.ApplicationFieldBk</class>
<class>com.olsa.amex.entities.ApplicationFieldBkWithAttachGood</class>
<class>com.olsa.amex.entities.ApplicationFieldStatus</class>
<class>com.olsa.amex.entities.ApplicationFieldTemplate</class>
<class>com.olsa.amex.entities.ApplicationFieldTemplateFixedValue</class>
<class>com.olsa.amex.entities.ApplicationOfferAndRegionRel</class>
<class>com.olsa.amex.entities.ApplicationOfferSuppBaseRel</class>
<class>com.olsa.amex.entities.ApplicationPacakge</class>
<class>com.olsa.amex.entities.ApplicationPackageArkDap</class>
<class>com.olsa.amex.entities.ApplicationProductOffer</class>
<class>com.olsa.amex.entities.ApplicationSection</class>
<class>com.olsa.amex.entities.ApplicationSectionPdf</class>
<class>com.olsa.amex.entities.ApplicationSectionTemplate</class>
<class>com.olsa.amex.entities.ApplicationSignaturePDF</class>
<class>com.olsa.amex.entities.ApplicationStatus</class>
<class>com.olsa.amex.entities.ApplicationTemplate</class>
<class>com.olsa.amex.entities.ApplicationTemplateBackUp</class>
<class>com.olsa.amex.entities.ApplicationTrace</class>
<class>com.olsa.amex.entities.AreaRegion</class>
<class>com.olsa.amex.entities.AreaSubRegion</class>
<class>com.olsa.amex.entities.AreamanagerAgent</class>
<class>com.olsa.amex.entities.BankList</class>
<class>com.olsa.amex.entities.BankList_old</class>
<class>com.olsa.amex.entities.BankList_two</class>
<class>com.olsa.amex.entities.Cab</class>
<class>com.olsa.amex.entities.CabList</class>
<class>com.olsa.amex.entities.CabList_old</class>
<class>com.olsa.amex.entities.CervedCredenzial</class>
<class>com.olsa.amex.entities.Comuni</class>
<class>com.olsa.amex.entities.Comuni_bck_20181227</class>
<class>com.olsa.amex.entities.Comuni_bck_old</class>
<class>com.olsa.amex.entities.ConfigurazioneSegnalazione</class>
<class>com.olsa.amex.entities.Cordinate_Firma_Agente</class>
<class>com.olsa.amex.entities.Crif</class>
<class>com.olsa.amex.entities.DboApplicationPacakge</class>
<class>com.olsa.amex.entities.ErrorSqlTrace</class>
<class>com.olsa.amex.entities.InternationalTelPrefix</class>
<class>com.olsa.amex.entities.Level_Rule</class>
<class>com.olsa.amex.entities.Nazionalita</class>
<class>com.olsa.amex.entities.NazioniIso</class>
<class>com.olsa.amex.entities.New</class>
<class>com.olsa.amex.entities.SBS_OfferList</class>
<class>com.olsa.amex.entities.SectionStatus</class>
<class>com.olsa.amex.entities.SegnalazioneApplicationSection</class>
<class>com.olsa.amex.entities.Segnalazioni</class>
<class>com.olsa.amex.entities.StorageCervedVisure</class>
<class>com.olsa.amex.entities.Sysdiagram</class>
<class>com.olsa.amex.entities.Teamleader_AM</class>
<class>com.olsa.amex.entities.TempSignersInfo</class>
<class>com.olsa.amex.entities.TemplateAppkeyStore</class>
<class>com.olsa.amex.entities.TipologiaSegnalazione</class>
<class>com.olsa.amex.entities.TokenPushService</class>
<class>com.olsa.amex.entities.UsedPassword</class>
<class>com.olsa.amex.entities.VersionMobile</class>
<class>com.olsa.amex.entities.VisureType</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://rmarjboss-001c.customer.olsa:3306/amex_digital_test_dev"/>
<property name="javax.persistence.jdbc.user" value="usrmysql"/>
<property name="javax.persistence.jdbc.password" value="******"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="eclipselink.logging.level" value="FINEST"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.composite-unit.member" value="true"/>
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.MySQLPlatform"/>
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.create-ddl-jdbc-file-name" value="create.sql"/>
<property name="eclipselink.deploy-on-startup" value="true" />
</properties>
</persistence-unit>
Я запускаю процесс, перейдя в JPA Tools -> Создать таблицы из сущностей, и появляется всплывающее окно:
Я нажимаю «Готово», и затем появляется консоль, она не выдает ошибок, но ничего не делает:
apr 03, 2019 2:36:11 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: JPAAmex
...]
apr 03, 2019 2:36:11 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.17.Final}
apr 03, 2019 2:36:11 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
apr 03, 2019 2:36:11 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
apr 03, 2019 2:36:11 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProvi derImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
apr 03, 2019 2:36:11 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProvi derImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://rmarjboss-001c.customer.olsa:3306 /amex_digital_test_dev?useUnicode=yes&characterEncoding=UTF-8]
apr 03, 2019 2:36:11 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProvi derImpl buildCreator
INFO: HHH10001001: Connection properties: {user=usrmysql, password=****}
apr 03, 2019 2:36:11 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProvi derImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
apr 03, 2019 2:36:11 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProvi derImpl$PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
Wed Apr 03 14:36:11 CEST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
apr 03, 2019 2:36:12 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect
apr 03, 2019 2:36:12 PM org.hibernate.mapping.RootClass checkCompositeIdentifier
WARN: HHH000038: Composite-id class does not override equals(): com.olsa.amex.entities.ApplicationTrace
apr 03, 2019 2:36:12 PM org.hibernate.mapping.RootClass checkCompositeIdentifier
WARN: HHH000039: Composite-id class does not override hashCode(): com.olsa.amex.entities.ApplicationTrace
apr 03, 2019 2:36:13 PM org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateService
INFO: HHH000397: Using ASTQueryTranslatorFactory
apr 03, 2019 2:36:13 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProvi derImpl stop
INFO: HHH10001008: Cleaning up connection pool [jdbc:mysql://rmarjboss-001c.customer.olsa:3306 /amex_digital_test_dev?useUnicode=yes&characterEncoding=UTF-8]
Есть ли что-то, что я делаю не так? Это сэкономило бы мне много времени на создание таких таблиц. Заранее спасибо за помощь!
РЕДАКТИРОВАТЬ: Просто добавив одну вещь здесь: я просто использую проект JPA / Maven