дорогой, у меня все проблемы, когда я хочу вставить в свою базу данных mysql5.7
я получил некоторую информацию, подобную этой
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
Mon Apr 13 08:28:46 UTC 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL $.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 exist$ng applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting us$SSL=false, or set useSSL=true and provide truststore for server certificate verification
и здесь, когда я хочу вставить в свою базу данных
insert into New_Single_Order_Response (AveragePrice, BodyLength, CheckSum, ClOrdID, CumQty, Currency, ExecID, ExecTransType, ExecType, Fix_Protocol, L
astShares, LeavesQty, MsgSeqNum, MsgType, OrdStatus, OrdType, OrderID, OrderQty, SenderCompId, SendingTime, Side, Symbol, TargetCompID, Transa
ctTime) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
и вот мой код для вставки
try {
System.out.print("Message "+ message);
System.out.print("getExecutionReport "+tipeMessage);
newOrderSingleEntity newordersingleObj = new newOrderSingleEntity();
newordersingleObj.setSymbol(message.getString(Symbol.FIELD));
System.out.print(" symbol "+message.getString(Symbol.FIELD));
newordersingleObj.setMsgType(tipeMessage);
System.out.print(" tipeMessage "+tipeMessage);
newordersingleObj.setBodyLength(216);
System.out.print(" Body Length "+216);
newordersingleObj.setFixProtocol("FIX.4.2");
System.out.print("FixProtocol +FIX.4.2");
newordersingleObj.setTransactTime(message.getString(TransactTime.FIELD));
System.out.print(" time " +message.getString(TransactTime.FIELD));
newordersingleObj.setClOrdID(message.getString(ClOrdID.FIELD));
System.out.print(" ClOrdID "+message.getString(ClOrdID.FIELD));
newordersingleObj.setOrderID(message.getString(OrderID.FIELD));
System.out.print(" OrderID "+message.getString(OrderID.FIELD));
newordersingleObj.setExecID(message.getString(ExecID.FIELD));
System.out.print(" ExecID "+message.getString(ExecID.FIELD));
newordersingleObj.setExecTransType(message.getString(ExecTransType.FIELD));
System.out.print(" ExecTransType "+message.getString(ExecTransType.FIELD));
newordersingleObj.setOrdType(message.getString(OrdType.FIELD));
System.out.print(" OrdType "+message.getString(OrdType.FIELD));
newordersingleObj.setExecType(message.getString(ExecType.FIELD));
System.out.print(" ExecType "+message.getString(ExecType.FIELD));
newordersingleObj.setOrdStatus(message.getString(OrdStatus.FIELD));
System.out.print(" OrdStatus "+message.getString(OrdStatus.FIELD));
newordersingleObj.setSide(message.getInt(Side.FIELD));
System.out.print(" Side "+message.getInt(Side.FIELD));
newordersingleObj.setOrderQty(message.getDouble(OrderQty.FIELD));
System.out.print(" OrderQty "+message.getDouble(OrderQty.FIELD));
newordersingleObj.setLeavesQty(message.getDouble(LeavesQty.FIELD));
System.out.print(" LeavesQty "+message.getDouble(LeavesQty.FIELD));
newordersingleObj.setCumQty(message.getDouble(CumQty.FIELD));
System.out.print(" CumQty "+message.getDouble(CumQty.FIELD));
newordersingleObj.setLastShares(message.getInt(LastShares.FIELD));
System.out.print(" LastQty "+message.getInt(LastShares.FIELD));
System.out.print("sebelum insert ke db");
RepositoryFactory.getOrderRepository().create(newordersingleObj);
} catch (FieldNotFound e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
и вот мой пом. xml
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.3.6.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
</dependency>
и вот мое упорство. xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="FastMatch" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>com.allaroundjava.hibernate.model.Car</class>
<properties>
<property name="eclipselink.logging.level" value="INFO"/>
<property name="eclipselink.logging.level.sql" value="FINE"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL57Dialect"/>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://url:3306/dxtr_trades"/>
<property name="javax.persistence.jdbc.user" value="user" />
<property name="javax.persistence.jdbc.password" value="password" />
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.show_sql" value="true"/>
<property name="eclipselink.logging.level.connection" value="FINEST"/>
</properties>
</persistence-unit>
</persistence>
ошибки нет, но когда я вижу в своей базе данных, мои данные не могут быть вставлены в мою базу данных .. как исправить мою вставку в мою базу данных, я попробуйте пример в inte rnet, но проблема по-прежнему случается.