java - how to Solve SQL Integrity Constraint Violation Exception -


i created entity class has same properties project.java, , created class can persist entity object. also, created database using databases in netbeans using embedded jdbc. have persistence.xml, provides properties connect db, , used persitence class on entitymanagerfactory object. connection seems fine having "internal exception: java.sql.sqlintegrityconstraintviolationexception: column 'project_id' cannot accept null value." error.

is ok create db manually (executing ddl) or should create table in persistence.xml using "property name="javax.persistence.jdbc.url"" value="create-tables" ?

regards

you have set value of column project_id.

you can either in code, example using annotations @sequencegenerator or @genericgenerator, or use db features (trigger) set id during insert.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -