Showing posts with label EclipseLink. Show all posts
Showing posts with label EclipseLink. Show all posts

Tuesday, May 28, 2013

EclipseLink: disable caching

To disable caching you have to add the following linen to your persistence.xml file:

<property name="eclipselink.cache.shared.default" value="false"/>

Resource:
http://stackoverflow.com/questions/2809275/disable-caching-in-jpa-eclipselink

Monday, May 27, 2013

Netbeans entity - EclipseLink: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails

I was getting this error:

Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`bismarksi/orders`, CONSTRAINT `FK_Orders_CLIENTID` FOREIGN KEY (`CLIENTID`) REFERENCES `clients` (`ID`))Error Code: 1452Call: INSERT INTO Orders (ID, CLIENTID, MODIFIEDDATE, ORDERSTATUSID, PROJECTID, RECEIPTDATE, SELLERID) VALUES (?, ?, ?, ?, ?, ?, ?)bind => [7 parameters bound]Query: InsertObjectQuery(com.expertix.bismark.si.entities.Order[ id=1 , projectId=1 , orderStatusId=1  ])

I solved the error adding to the entity the set and get method for the clientId Attribute:

   public int getClientId() {
        return clientId;
    }

    public void setClientId(int clientId) {
        this.clientId = clientId;
    }