org.hibernate.exception.ConstraintViolationException: NULL не допускается для столбца? что послужило причиной этой ошибки?

   i am not add any null in "productName" but error   org.hibernate.exception.ConstraintViolationException: NULL not allowed for column "PRODUCTNAME"; SQL statement

шибка null не разрешена имя продукта, так как я могу решить эту проблему HTTP Status 500 - Ошибка обработки запроса; вложенным исключением является org.hibernate.exception.ConstraintViolationException: NULL не допускается для столбца «PRODUCTNAME»; Оператор SQL:

    org.hibernate.engine.jdbc.spi.SqlExceptionHelper.logExceptions SQL Error: 23502, SQLState: 23502

 org.hibernate.engine.jdbc.spi.SqlExceptionHelper.logExceptions NULL not allowed for column "PRODUCTNAME"; SQL statement  
Это полная ошибка:
   type: Exception report

        message Request processing failed; nested exception is org.hibernate.exception.ConstraintViolationException: NULL not allowed for column "PRODUCTNAME"; SQL statement:

        description The server encountered an internal error that prevented it from fulfilling this request.

        exception

        org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.exception.ConstraintViolationException: NULL not allowed for column "PRODUCTNAME"; SQL statement:
        insert into Product (productId, productCategory, productCondition, productDescription, productManufacturer, productName, productPrice, productStatus, unitInStock) values (null, ?, ?, ?, ?, ?, ?, ?, ?) [23502-196]
            org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
            org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
            org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
            org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        root cause

        org.hibernate.exception.ConstraintViolationException: NULL not allowed for column "PRODUCTNAME"; SQL statement:
        insert into Product (productId, productCategory, productCondition, productDescription, productManufacturer, productName, productPrice, productStatus, unitInStock) values (null, ?, ?, ?, ?, ?, ?, ?, ?) [23502-196]
            org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:128)
            org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
            org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
            org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
            org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)
            org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
            com.sun.proxy.$Proxy47.executeUpdate(Unknown Source)
            org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:96)
            org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:55)
            org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2757)
            org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3268)
            org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:78)
            org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:272)
            org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:304)
            org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:195)
            org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:128)
            org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:204)
            org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:189)
            org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:114)
            org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
            org.hibernate.internal.SessionImpl.fireSaveOrUpdate(SessionImpl.java:615)
            org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:608)
            org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:604)
            com.emusicstore.dao.impl.ProductDaoImpl.addProduct(ProductDaoImpl.java:25)
            sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            java.lang.reflect.Method.invoke(Method.java:497)`enter code here`
            org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
            org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
            org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
            org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
            org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
            org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
            org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
            org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
            com.sun.proxy.$Proxy42.addProduct(Unknown Source)
            com.emusicstore.controller.HomeController.addProductPost(HomeController.java:84)
            sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            java.lang.reflect.Method.invoke(Method.java:497)
            org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
            org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
            org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
            org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)
            org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)
            org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
            org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
            org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
            org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
            org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
            org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
            org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        root cause

        org.h2.jdbc.JdbcSQLException: NULL not allowed for column "PRODUCTNAME"; SQL statement:
        insert into Product (productId, productCategory, productCondition, productDescription, productManufacturer, productName, productPrice, productStatus, unitInStock) values (null, ?, ?, ?, ?, ?, ?, ?, ?) [23502-196]
            at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
            at org.h2.message.DbException.get(DbException.java:179)
            at org.h2.message.DbException.get(DbException.java:155)
            at org.h2.table.Column.validateConvertUpdateSequence(Column.java:345)
            at org.h2.table.Table.validateConvertUpdateSequence(Table.java:797)
            at org.h2.command.dml.Insert.insertRows(Insert.java:151)
            at org.h2.command.dml.Insert.update(Insert.java:114)
            at org.h2.command.CommandContainer.update(CommandContainer.java:101)
            at org.h2.command.Command.executeUpdate(Command.java:260)
            at org.h2.server.TcpServerThread.process(TcpServerThread.java:354)
            at org.h2.server.TcpServerThread.run(TcpServerThread.java:158)
            at java.lang.Thread.run(Unknown Source)

            org.h2.engine.SessionRemote.done(SessionRemote.java:629)
            org.h2.command.CommandRemote.executeUpdate(CommandRemote.java:209)
            org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:164)
            org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:150)
            sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            java.lang.reflect.Method.invoke(Method.java:497)
            org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
            org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
            com.sun.proxy.$Proxy47.executeUpdate(Unknown Source)
            org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:96)
            org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:55)
            org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2757)
            org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3268)
            org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:78)
            org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:272)
            org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:304)
            org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:195)
            org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:128)
            org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:204)
            org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:189)
            org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:114)
            org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
            org.hibernate.internal.SessionImpl.fireSaveOrUpdate(SessionImpl.java:615)
            org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:608)
            org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:604)
            com.emusicstore.dao.impl.ProductDaoImpl.addProduct(ProductDaoImpl.java:25)
            sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            java.lang.reflect.Method.invoke(Method.java:497)
            org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
            org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
            org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
            org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
            org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
            org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
            org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
            org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
            com.sun.proxy.$Proxy42.addProduct(Unknown Source)
            com.emusicstore.controller.HomeController.addProductPost(HomeController.java:84)
            sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            java.lang.reflect.Method.invoke(Method.java:497)
            org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
            org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
            org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
            org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)
            org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)
            org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
            org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
            org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
            org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
            org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
            org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
            org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        note The full stack trace of the root cause is available in the Apache Tomcat/8.0.28 logs.
моя страница добавления продукта:

это добавить код товара

    <%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
    <%@include file="/WEB-INF/views/template/header.jsp"%>


    <div class="container-wrapper">
        <div class="container">
            <div class="page-header">
                <h1>Add Product</h1>
                <p class="lead">Fill the below information to a  product: </p>
            </div>


          <form:form action="${pageContext.request.contextPath}/admin/productInventory/addProduct"  method="post"  commandName="product" enctype="multipart/form-data">

            <div class="form-group">
                <label for="name">Name</label>
                <form:input path="productName" id="name" class="form-Control"/>
            </div>

            <div class="form-group">
                <label for="category">Category</label>
                <label class="checkbox-inline"><form:radiobutton path="productCategory" id="category" value="instrument"/>Instrument</label>
                <label class="checkbox-inline"><form:radiobutton path="productCategory" id="category" value="record"/>Record</label>
                <label class="checkbox-inline"><form:radiobutton path="productCategory" id="category" value="accessory"/>Accessory</label>

            </div>

            <div class="form-group">
                <label for="description">Description</label>
                <form:textarea path="productDescription" id="description" class="form-Control"/>
            </div>

            <div class="form-group">
                <label for="price">Price</label>
                <form:input path="productPrice" id="price" class="form-Control"/>
            </div>

            <div class="form-group">
                <label for="condition">Condition</label>
                <label class="checkbox-inline"><form:radiobutton path="productCondition" id="condition" value="new"/>New</label>
                <label class="checkbox-inline"><form:radiobutton path="productCondition" id="condition" value="used"/>Used</label>

            </div>



            <div class="form-group">
                <label for="status">Status</label>
                <label class="checkbox-inline"><form:radiobutton path="productStatus" id="status" value="active"/>Active</label>
                <label class="checkbox-inline"><form:radiobutton path="productStatus" id="status" value="inactive"/>Inactive</label>

            </div>

            <div class="form-group">
                <label for="unitInstock">Unit In stock</label>
                <form:input path="unitInStock" id="unitInstock" class="form-Control"/>
            </div>

            <div class="form-group">
                <label for="manufacturer">Manufacturer</label>
                <form:input path="productManufacturer" id="manufacturer" class="form-Control"/>
            </div>

            <div class="form-group">
                <label class="control-label" for="productImage">Upload Picture</label>
                <form:input id="productImage" path="productImage" type="file" class="form:input-large"/>

            </div>

            <br><br>

            <input type="submit" value="submit" class="btn btn-success">
            <a href="<c:url value="/admin/productInventory"/> " class="btn btn-default">Cancle</a>



            </form:form>
    <%@include file="/WEB-INF/views/template/footer.jsp"%>
мой контроллер сопоставления:

это код продукта

    //productimage code
    @RequestMapping(value = "/admin/productInventory/addProduct" , method = RequestMethod.POST)
        public String addProductPost(@ModelAttribute("product") Product product, HttpServletRequest request){

            productDao.addProduct(product);

            MultipartFile productImage = product.getProductImage();
            String rootDirectory = request.getSession().getServletContext().getRealPath("/");
            path = Paths.get(rootDirectory + "\\WEB-INF\\resources\\images\\"+product.getProductId()+".png");

            if (productImage !=null && !productImage.isEmpty())
            {
                try{
                    productImage.transferTo(new File(path.toString()));
                }catch (Exception e)
                {
                    e.printStackTrace();
                    throw new RuntimeException("Product image saving failed",e);

                }
            }

            return "redirect:/admin/productInventory";

        }
   productimage//
моя модель Product.java
    this is add our product column

    package com.emusicstore.model;

    import org.springframework.web.multipart.MultipartFile;

    import javax.persistence.*;

    @Entity

    public class Product {

        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)

        private String productId;
        private String productName;
        private String productCategory;
        private String productDescription;
        private double productPrice;
        private String productCondition;
        private String productStatus;
        private int unitInStock;
        private String productManufacturer;

        @Transient//automatic create productImage in database
        private MultipartFile productImage;

        public String getProductId() {
            return productId;
        }

        public void setProductId(String productId) {
            this.productId = productId;
        }



        public String getProductName() {
            return productName;
        }

        public void setProductName(String productName) {
            this.productName = productName;
        }

        public String getProductCategory() {
            return productCategory;
        }

        public void setProductCategory(String productCategory) {
            this.productCategory = productCategory;
        }

        public String getProductDescription() {
            return productDescription;
        }

        public void setProductDescription(String productDescription) {
            this.productDescription = productDescription;
        }

        public double getProductPrice() {
            return productPrice;
        }

        public void setProductPrice(double productPrice) {
            this.productPrice = productPrice;
        }

        public String getProductCondition() {
            return productCondition;
        }

        public void setProductCondition(String productCondition) {
            this.productCondition = productCondition;
        }

        public String getProductStatus() {
            return, productStatus;
        }

        public void setProductStatus(String productStatus) {
            this.productStatus = productStatus;
        }

        public int getUnitInStock() {
            return unitInStock;
        }

        public void setUnitInStock(int unitInStock) {
            this.unitInStock = unitInStock;
        }

        public String getProductManufacturer() {
            return productManufacturer;
        }

        public void setProductManufacturer(String productManufacturer) {
            this.productManufacturer = productManufacturer;
        }


        public MultipartFile getProductImage() {
            return productImage;
        }

        public void setProductImage(MultipartFile productImage) {
            this.productImage = productImage;
        }
    }
мой продукт
    package com.emusicstore.dao.impl;

    import com.emusicstore.dao.ProductDao;
    import com.emusicstore.model.Product;
    import org.hibernate.Query;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Repository;
    import org.springframework.transaction.annotation.Transactional;

    import java.util.List;


    @Repository
    @Transactional
    public class ProductDaoImpl implements ProductDao {


        @Autowired
        private SessionFactory sessionFactory;

        public void addProduct(Product product){
            Session session = sessionFactory.getCurrentSession();
            session.saveOrUpdate(product);
            session.flush();
        }

        public Product getProductById(String id){
            Session session = sessionFactory.getCurrentSession();
            Product product = (Product) session.get(Product.class,id);
            session.flush();
            return product;
        }

        public List<Product> getAllProducts(){
            Session session = sessionFactory.getCurrentSession();
            Query query = session.createQuery("from Product");
            List<Product> products= query.list();
            session.flush();

            return products;
        }

        public void deleteProduct(String id){
            Session session = sessionFactory.getCurrentSession();
            session.delete(getProductById(id));
            session.flush();


        }
    }

pom.xml for image
-----------------

это наш pom.xml для изображения

  <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.2.2</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>

на самом деле в чем ошибка, в результате я не могу вставить свой файл в базу данных, пожалуйста, помогите мне

 user892153229 нояб. 2017 г., 21:46
Как решить эту проблему ?
 Shen29 нояб. 2017 г., 17:25
Вопрос в том, почему вы не проверяете свою форму, прежде чем опубликовать ее? потому что когда вы проверяете все поля, вы можете убедиться, что ваши данные не пропали, а ваша бизнес-логика основана на каждом поле, которое вы хотите, может работать так, как вы ожидаете
 mjuarez29 нояб. 2017 г., 19:57
Ошибка довольно очевидна, это поле не допускает пустые значения в таблице. Поэтому вам следует сначала попытаться исправить это.
 Shen29 нояб. 2017 г., 17:20
Можете ли вы отслеживать ваш ProductName виден? чтобы исправить это, вам нужно проверить, что ваш столбец productName не равен NULL

Ответы на вопрос(1)

вызовом функции убедитесь, что он не равен нулюsaveOrUpdate ИЛИ ЖЕ удалитьненулевой ограничение из таблицы в вашей базе данных.

 user892153229 нояб. 2017 г., 19:48
org.hibernate.exception.ConstraintViolationException: NULL не допускается для столбца? что послужило причиной этой ошибки?
 Zeromus29 нояб. 2017 г., 17:02
Или из объявления объекта, так как вы используете h2, я могу сделать вывод, что возможно, он генерируется автоматически
 user892153229 нояб. 2017 г., 17:09
так как я мог решить эту проблему?
 user892153229 нояб. 2017 г., 18:57
нет, это работает, но я не могу добавить базу данных
 DevJava29 нояб. 2017 г., 17:17
измените свой метод addProduct следующим образом if (product.getName ()! = null) {session.saveOrUpdate (product); }

Ваш ответ на вопрос