Значение не найдено или ?? при вставке в mysql - PullRequest
0 голосов
/ 13 апреля 2020

Привет всем, у меня проблемы, когда я хочу вставить данные в мою базу данных ...

insert into New_Single_Order_Response (AveragePrice, BodyLength, CheckSum, ClOrdID, CumQty, Currency, ExecID, ExecTransType, ExecType, Fix_Protocol, LastShares, LeavesQty, MsgSeqNum, MsgType, OrdStatus, OrdType, OrderID, OrderQty, SenderCompId, SendingTime, Side, Symbol, TargetCompID, TransactTime) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

, но мои данные не могут быть вставлены в мою базу данных ... почему так?

сначала я установил мое постоянство. 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.dxtr.hibernate.newOrderSingleEntity</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="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://Url/dxtr_trades" />
            <property name="javax.persistence.jdbc.user" value="username" />
            <property name="javax.persistence.jdbc.password" value="password" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL57InnoDBDialect" />
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="eclipselink.logging.level.connection" value="FINEST"/>
              </properties>
             </persistence-unit>
</persistence>    

, и это моя сущность

 @Entity
    @Table(name="New_Single_Order_Response")
    public class newOrderSingleEntity  implements Serializable{
         private static final long serialVersionUID = -1234424538928L;
          @Id
            @Column(name="response_id")
            @GeneratedValue(strategy=GenerationType.IDENTITY)
            private Integer id;

            @Column(name="Fix_Protocol")
            private String FixProtocol;

            @Column(name="BodyLength")
            private Integer BodyLength;

            @Column(name="MsgSeqNum")
            private Integer MsgSeqNum;

            @Column(name="MsgType")
            private String MsgType;

            @Column(name="SenderCompId")
            private String SenderCompId;

            @Column(name="SendingTime")
            private String SendingTime;

            @Column(name="TargetCompID")
            private String TargetCompID;

            @Column(name="AveragePrice")
            private Double AveragePrice;

            @Column(name="ClOrdID")
            private String ClOrdID;

            @Column(name="CumQty")
            private double CumQty;

            @Column(name="Currency")
            private String Currency;

            @Column(name="ExecID")
            private String ExecID;

            @Column(name="LastShares")
            private double LastShares;

            @Column(name="OrderQty")
            private Double OrderQty;

            @Column(name="OrdStatus")
            private String OrdStatus;

            @Column(name="OrdType")
            private String OrdType;

            @Column(name="Side")
            private Integer Side;

            @Column(name="Symbol")
            private String Symbol;

            @Column(name="TransactTime")
            private String TransactTime;

            @Column(name="ExecType")
            private String ExecType;

            @Column(name="LeavesQty")
            private double LeavesQty;

            @Column(name="CheckSum")
            private Integer CheckSum;

            @Column(name="ExecTransType")
            private String ExecTransType;

            @Column(name="OrderID")
            private String OrderID;


            public Integer getResponse_ID() {
                return this.id;
            }

            public void setResponse_ID(Integer id) {
                this.id = id;
            }

            public String getFixProtocol() {
                return this.FixProtocol;
            }

            public void setFixProtocol(String FixProtocol) {
                this.FixProtocol = FixProtocol;
            }

            public Integer getBodyLength() {
                return this.BodyLength;
            }

            public void setBodyLength(Integer BodyLength) {
                this.BodyLength = BodyLength;
            }

            public Integer getMsgSeqNum() {
                return this.MsgSeqNum;
            }

            public void setMsgSeqNum(Integer MsgSeqNum) {
                this.MsgSeqNum = MsgSeqNum;
            }


            public String getMsgType() {
                return this.MsgType;
            }

            public void setMsgType(String MsgType) {
                this.MsgType = MsgType;
            }

            public String getSenderCompId() {
                return this.SenderCompId;
            }

            public void setSenderCompId(String SenderCompId) {
                this.SenderCompId = SenderCompId;
            }

            public String getSendingTime() {
                return this.SendingTime;
            }

            public void setBodyLength(String SendingTime) {
                this.SendingTime = SendingTime;
            }

            public String getTargetCompID() {
                return this.TargetCompID;
            }

            public void setTargetCompID(String TargetCompID) {
                this.TargetCompID = TargetCompID;
            }

            public Double getAveragePrice() {
                return this.AveragePrice;
            }

            public void setAveragePrice(Double AveragePrice) {
                this.AveragePrice = AveragePrice;
            }

            public String getClOrdID() {
                return this.ClOrdID;
            }

            public void setClOrdID(String ClOrdID) {
                this.ClOrdID = ClOrdID;
            }

            public double getCumQty() {
                return this.CumQty;
            }

            public void setCumQty(double CumQty) {
                this.CumQty = CumQty;
            }

            public String getCurrency() {
                return this.Currency;
            }

            public void setCurrency(String Currency) {
                this.Currency = Currency;
            }

            public String getExecID() {
                return this.ExecID;
            }

            public void setExecID(String ExecID) {
                this.ExecID = ExecID;
            }

            public double getLastShares() {
                return this.LastShares;
            }

            public void setLastShares(double LastShares) {
                this.LastShares = LastShares;
            }

            public Double getOrderQty() {
                return this.OrderQty;
            }

            public void setOrderQty(Double OrderQty) {
                this.OrderQty = OrderQty;
            }

            public String getExecType() {
                return this.ExecType;
            }

            public void setExecType(String ExecType) {
                this.ExecType = ExecType;
            }

            public String getOrdStatus() {
                return this.OrdStatus;
            }

            public void setOrdStatus(String OrdStatus) {
                this.OrdStatus = OrdStatus;
            }

            public String getOrdType() {
                return this.OrdType;
            }

            public void setOrdType(String OrdType) {
                this.OrdType = OrdType;
            }

            public Integer getSide() {
                return this.Side;
            }

            public void setSide(Integer Side) {
                this.Side = Side;
            }

            public String getSymbol() {
                return this.Symbol;
            }

            public void setSymbol(String Symbol) {
                this.Symbol = Symbol;
            }

            public String getTransactTime() {
                return this.TransactTime;
            }

            public void setTransactTime(String TransactTime) {
                this.TransactTime = TransactTime;
            }

            public double getLeavesQty() {
                return this.LeavesQty;
            }

            public void setLeavesQty(double LeavesQty) {
                this.LeavesQty = LeavesQty;
            }

            public Integer getCheckSum() {
                return this.CheckSum;
            }

            public void setCheckSum(Integer CheckSum) {
                this.CheckSum = CheckSum;
            }

            public String getExecTransType() {
                return this.ExecTransType;
            }

            public void setExecTransType(String ExecTransType) {
                this.ExecTransType = ExecTransType;
            }

            public String getOrderID() {
                return this.OrderID;
            }

            public void setOrderID(String OrderID) {
                this.OrderID = OrderID;
            }

            public String toString() {
                return "OrderDetail?= Id: " + this.id + ", ClOrdID: " + this.ClOrdID + ", ExecID No.: " + this.ExecID + ", Symbol: " + this.Symbol;
            }



    }

, и это мой код для вставки в мою базу данных

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));
    } catch (FieldNotFound e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }


    }

я использую try catch, но ошибки нет ... я думаю, что мои приложения также не могут запускать мой режим гибернации

когда я регистрирую значение, которое я хочу вставить, существует, а значение нет ?? ?? так в чем именно моя проблема? и как исправить мою проблему? что я хочу сделать, это вставить эти данные в mydatabase mysql5.7

, и это библиотека, которую я использую здесь

enter image description here

после я изменяю свой mysqlconnector я получил информацию как

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.

в чем именно проблема?

1 Ответ

0 голосов
/ 14 апреля 2020

это близко после того, как я обновил свой mysql -коннектор, используя mysql коннектор 8, а затем после того, как я использовал в своем постоянстве. xml

...