Return-Path: X-Original-To: apmail-isis-users-archive@www.apache.org Delivered-To: apmail-isis-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 07E091757A for ; Fri, 6 Mar 2015 14:30:16 +0000 (UTC) Received: (qmail 65265 invoked by uid 500); 6 Mar 2015 14:30:12 -0000 Delivered-To: apmail-isis-users-archive@isis.apache.org Received: (qmail 65230 invoked by uid 500); 6 Mar 2015 14:30:12 -0000 Mailing-List: contact users-help@isis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@isis.apache.org Delivered-To: mailing list users@isis.apache.org Received: (qmail 65219 invoked by uid 99); 6 Mar 2015 14:30:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2015 14:30:12 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [209.85.223.182] (HELO mail-ie0-f182.google.com) (209.85.223.182) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2015 14:29:45 +0000 Received: by iecrl12 with SMTP id rl12so3047989iec.5 for ; Fri, 06 Mar 2015 06:27:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=5tCpuBRRU75bPY+oBpAuaLpIwtQGN6+aF1zXDt+4Fa8=; b=KMIqfjKysUBPfWlcm29oOpsVyGM9gb9otY+c5SC78N+Ca5GdqZqQxr3yI07mQhPuwB phk39yBVx1QXESuwgkGAYOZnI5wEyFxCfRDuxENz+pUVN1I7KRHi1OaEJSHt9C77/aC8 vaLHP2gdxCjP+xhJQH32py/6ZhRbYbGdV8MG58Za3HSAYmUo8lWaO+SWiz+00gbSLeB2 SVP0pj3BjVgSU4kbpL72OyDnGzmjhgMM67HSlGuwfP6K2i5XyrV1Mi7LBb3YD+RlQams +kLWqJNTCFDfXCYYo+Fpk0TifV7STmdZdhSaMrLnmx0gr9R3yIYaQ5zQvfwclPeS7CR+ SVzg== X-Gm-Message-State: ALoCoQncfH9xx8utaqaB7A8LO1neW8PyrlW5JowkMgzSDvD/lZOojIABttS8WS2u351FSJ/gqJ+K X-Received: by 10.42.95.70 with SMTP id e6mr10265346icn.14.1425652073174; Fri, 06 Mar 2015 06:27:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.55.135 with HTTP; Fri, 6 Mar 2015 06:27:32 -0800 (PST) X-Originating-IP: [81.132.83.159] In-Reply-To: References: From: Dan Haywood Date: Fri, 6 Mar 2015 14:27:32 +0000 Message-ID: Subject: Re: Not able to add 1:m bidirectional relationship To: users Content-Type: multipart/alternative; boundary=20cf3036400f65746d05109f7dd8 X-Virus-Checked: Checked by ClamAV on apache.org --20cf3036400f65746d05109f7dd8 Content-Type: text/plain; charset=UTF-8 Hi Marianne, If "Idx" isn't a property that you've explicitly added, then it's probably been added through some DN annotation that you have (is my guess). So, could you show us the DN annotations for the entity that's mapped to the failing table ("regulation_clauses"). (Or, the annotations for the collection if that's what it actually is). ~~~ Also, let's enable some extra logging. In WEB-INF/logging.properties, switch these two properties to DEBUG: # DataNucleus # the first two log the DML and DDL (if set to DEBUG) log4j.logger.DataNucleus.Datastore.Native=DEBUG, Console log4j.logger.DataNucleus.Datastore.Schema=DEBUG, Console Also, in persistor.properties, you could enable the log4jdbc-remix driver, eg, if using hsqldb then comment out: #isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver #isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:hsqldb:mem:test #isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa #isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword= and replace with (below): isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=net.sf.log4jdbc.DriverSpy isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:log4jdbc:hsqldb:mem:test isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword= Hopefully in your console you'll be able to search for 'idx' and we'll get a clue what it relates to. Thx Dan On 6 March 2015 at 14:19, Marianne Hagaseth < Marianne.Hagaseth@marintek.sintef.no> wrote: > Thanks for replying so quickly! > > 'Idx' is not a field added by me, thus, it is created by Isis/DN, I think? > Some index-stuff for the database table? > > Best, > Marianne. > > -----Original Message----- > From: Martin Grigorov [mailto:mgrigorov@apache.org] > Sent: 6. mars 2015 15:10 > To: users > Subject: Re: Not able to add 1:m bidirectional relationship > > java.sql.SQLException: Field 'idx' doesn't have a default value > > Do you have an entity with field 'idx' in your model ? > Or it could be something created by Isis/DN, I don't know. > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Fri, Mar 6, 2015 at 4:06 PM, Marianne Hagaseth < > Marianne.Hagaseth@marintek.sintef.no> wrote: > > > Yes, a lot. See below. > > It seems like the values are not picked up, and then the insert into > > the database tables fails because the columns are NOT NULL and no > > default values exists. > > > > Some more from the STACK: > > > > Caused by: > > org.datanucleus.store.rdbms.exceptions.MappedDatastoreException: > > INSERT INTO regulation_clauses (id_oid,id_eid) VALUES (?,?) > > at > > > org.datanucleus.store.rdbms.scostore.JoinSetStore.doInternalAdd(JoinSetStore.java:754) > > at > > > org.datanucleus.store.rdbms.scostore.JoinSetStore.internalAdd(JoinSetStore.java:502) > > at > > > org.datanucleus.store.rdbms.scostore.JoinSetStore.add(JoinSetStore.java:333) > > ... 71 more > > Caused by: java.sql.SQLException: Field 'idx' doesn't have a default > > value > > > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > And more: > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > > > ... 73 more > > Nested Throwables StackTrace: > > org.datanucleus.store.rdbms.exceptions.MappedDatastoreException: > > INSERT INTO regulation_clauses (id_oid,id_eid) VALUES (?,?) > > at > > org.datanucleus.store.rdbms.scostore.JoinSetStore.doInternalAdd(JoinSe > > tStore.java:754) > > > > at > > > org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) > > at > > org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.ja > > va:582) Caused by: java.sql.SQLException: Field 'idx' doesn't have a > > default value > > at > > com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) > > > > at > > > org.datanucleus.store.rdbms.scostore.JoinSetStore.doInternalAdd(JoinSetStore.java:733) > > ... 73 more > > > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > And more: > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > > > 14:45:38,105 [Persistence 1661257338@qtp-721005297-3 WARN ] > > Execution of method "add" on field "clauses" caused an error : Add > > request failed : INSERT INTO regulation_clauses (id_oid,id_eid) VALUES > > (?,?) Add request failed : INSERT INTO regulation_clauses > > (id_oid,id_eid) VALUES > > (?,?) > > org.datanucleus.exceptions.NucleusDataStoreException: Add request failed > : > > INSERT INTO regulation_clauses (id_oid,id_eid) VALUES (?,?) > > at > > > org.datanucleus.store.rdbms.scostore.JoinSetStore.add(JoinSetStore.java:349) > > at > > org.datanucleus.store.types.backed.SortedSet.add(SortedSet.java:716) > > > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > And more: > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > > > at > > > org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) > > at > > org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.ja > > va:582) > > Caused by: > > org.datanucleus.store.rdbms.exceptions.MappedDatastoreException: > > INSERT INTO regulation_clauses (id_oid,id_eid) VALUES (?,?) > > at > > > org.datanucleus.store.rdbms.scostore.JoinSetStore.doInternalAdd(JoinSetStore.java:754) > > at > > > org.datanucleus.store.rdbms.scostore.JoinSetStore.internalAdd(JoinSetStore.java:502) > > at > > > org.datanucleus.store.rdbms.scostore.JoinSetStore.add(JoinSetStore.java:333) > > ... 71 more > > Caused by: java.sql.SQLException: Field 'idx' doesn't have a default > value > > at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) > > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887) > > > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > And more: > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > > > at > > > org.datanucleus.store.rdbms.scostore.JoinSetStore.doInternalAdd(JoinSetStore.java:733) > > ... 73 more > > Nested Throwables StackTrace: > > org.datanucleus.store.rdbms.exceptions.MappedDatastoreException: > > INSERT INTO regulation_clauses (id_oid,id_eid) VALUES (?,?) > > at > > > org.datanucleus.store.rdbms.scostore.JoinSetStore.doInternalAdd(JoinSetStore.java:754) > > at > > org.datanucleus.store.rdbms.scostore.JoinSetStore.internalAdd(JoinSetS > > tore.java:502) > > > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > And more: > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > > > at > > > org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) > > at > > org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.ja > > va:582) Caused by: java.sql.SQLException: Field 'idx' doesn't have a > > default value > > at > > com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) > > > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > And more: > > <<<<<<<<<<<<<<<<<<<<<<<<<<< > > > > Best > > -Marianne. > > > > -----Original Message----- > > From: Martin Grigorov [mailto:mgrigorov@apache.org] > > Sent: 6. mars 2015 14:53 > > To: users > > Subject: Re: Not able to add 1:m bidirectional relationship > > > > Hi, > > > > > > On Fri, Mar 6, 2015 at 3:51 PM, Marianne Hagaseth < > > Marianne.Hagaseth@marintek.sintef.no> wrote: > > > > > Hi, > > > I am trying to add a 1:m bidirectional relationship, but it fails. > > > I wonder if could be a mismatch between the versions used for some > > > of the stuff needed. > > > My set up looks like: > > > > > > > > > * isis-core-webserver 1.7.0 > > > > > > * datanucleus-api-jdo-3.2.7 > > > > > > * Eclipse Java EE IDE 4.4.2 > > > > > > * mysql-connector-java-5.1.34 > > > > > > * mysql server 5.6.23 > > > > > > * Jdk 1.7.0_75 > > > > > > > > > It fails here at backingStore.add(...): > > > > > > try > > > > > > { > > > > > > backingStore.add(ownerOP,element, (useCache ? > > > delegate.size() : -1)); > > > > > > } > > > > > > catch (NucleusDataStoreException dse) > > > > > > { > > > > > > > > > NucleusLogger.PERSISTENCE.warn(LOCALISER.msg("023013", > > > "add", ownerMmd.getName(), dse)); > > > > > > backingSuccess = false; > > > > > > } > > > With Error message: > > > > > > 12:20:54,055 [Datastore 1844639495@qtp-721005297-3 ERROR] > > > org.datanucleus.store.rdbms.exceptions.MappedDatastoreException: > > > INSERT INTO regulation_clauses (id_oid,id_eid) VALUES (?,?) > > > > > > 12:20:54,055 [Datastore 1844639495@qtp-721005297-3 ERROR] > > > org.datanucleus.store.rdbms.exceptions.MappedDatastoreException: > > > INSERT INTO regulation_clauses (id_oid,id_eid) VALUES (?,?) > > > > > > 12:20:54,055 [Datastore 1844639495@qtp-721005297-3 ERROR] > > > Add request failed : INSERT INTO regulation_clauses (id_oid,id_eid) > > > VALUES > > > (?,?) > > > > > > 12:20:54,055 [Datastore 1844639495@qtp-721005297-3 ERROR] > > > Add request failed : INSERT INTO regulation_clauses (id_oid,id_eid) > > > VALUES > > > (?,?) > > > > > > 12:20:54,056 [Persistence 1844639495@qtp-721005297-3 WARN ] > > > Execution of method "add" on field "clauses" caused an error : Add > > > request failed : INSERT INTO regulation_clauses (id_oid,id_eid) > > > VALUES > > > (?,?) > > > > > > Add request failed : INSERT INTO regulation_clauses (id_oid,id_eid) > > > VALUES > > > (?,?) > > > > > > org.datanucleus.exceptions.NucleusDataStoreException: Add request > > > failed > > : > > > INSERT INTO regulation_clauses (id_oid,id_eid) VALUES (?,?) > > > > > > at > > > org.datanucleus.store.rdbms.scostore.JoinSetStore.add(JoinSetStore.j > > > av > > > a:349) > > > > > > at > > > org.datanucleus.store.types.backed.SortedSet.add(SortedSet.java:716) > > > > > > at dom.regulation.Regulation.addClause(Regulation.java:795) > > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native > > > Method) > > > > > > at > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl > > > .j > > > ava:57) > > > > > > at > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce > > > ss > > > orImpl.java:43) > > > > > > > > > etc.etc... > > > > > > > Is there "Caused by: ..." down in the stack ? > > > > > > > > > > Best regards, > > > Marianne Hagaseth > > > > > > > > > --20cf3036400f65746d05109f7dd8--