---------- Пересланное сообщение ---------- От кого: Web developer <[email protected]> Дата: 27 мая 2010 г. 15:27 Тема: Re: Test run Кому: Rick Curtis <[email protected]>
>Since there are multiple persistence units defined in the p.xml file that you specified, we incorrectly try to create the >OPENJPA_SEQUENCE_TABLE multiple times. Not that big of a deal. Here is my updated persistence.xml: <?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"> <persistence-unit name="embeddables" transaction-type="RESOURCE_LOCAL"> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> <class>Address</class> <class>ContactInfo</class> <class>Phone</class> <class>User</class> </persistence-unit> </persistence> 310 embeddables INFO [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.H2Dictionary". 385 embeddables INFO [main] openjpa.Runtime - Creating sequence table. 1814 embeddables TRACE [main] openjpa.jdbc.SQL - <t 644193719, conn 1498770706> executing stmnt 1260137319 CREATE TABLE OPENJPA_SEQUENCE_TABLE (ID TINYINT NOT NULL, SEQUENCE_VALUE BIGINT, PRIMARY KEY (ID)) 1826 embeddables TRACE [main] openjpa.jdbc.SQL - <t 644193719, conn 1498770706> [12 ms] spent 163 embeddables INFO [main] openjpa.Runtime - Starting OpenJPA 2.0.0-beta3 346 embeddables INFO [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.H2Dictionary". Exception in thread "main" <openjpa-2.0.0-beta3-r422266:926797 fatal store error> org.apache.openjpa.persistence.RollbackException: The transaction has been rolled back. See the nested exceptions for details on the errors that occurred. at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:573) at Main.init(Main.java:55) at Main.main(Main.java:10) Caused by: <openjpa-2.0.0-beta3-r422266:926797 fatal general error> org.apache.openjpa.persistence.PersistenceException: The transaction has been rolled back. See the nested exceptions for details on the errors that occurred. at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2279) at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2122) at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2020) at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1938) at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81) at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1462) at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:924) at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:556) ... 2 more Caused by: <openjpa-2.0.0-beta3-r422266:926797 fatal general error> org.apache.openjpa.persistence.PersistenceException: Таблица "USER0" не найдена Table "USER0" not found; SQL statement: INSERT INTO User0 (id, user, user_name, city, state, street, zip, number, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [42102-132] {INSERT INTO User0 (id, user, user_name, city, state, street, zip, number, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)} [code=42102, state=42S02] at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4827) at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4787) at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:136) at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:110) at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:62) at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:89) at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:550) at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:106) at org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(BatchingConstraintUpdateManager.java:59) at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:103) at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:76) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:743) at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130) ... 9 more Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Таблица "USER0" не найдена Table "USER0" not found; SQL statement: INSERT INTO User0 (id, user, user_name, city, state, street, zip, number, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [42102-132] {INSERT INTO User0 (id, user, user_name, city, state, street, zip, number, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)} [code=42102, state=42S02] at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:257) at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:237) at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$000(LoggingConnectionDecorator.java:70) at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection.prepareStatement(LoggingConnectionDecorator.java:289) at org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:186) at org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.prepareStatement(ConfiguringConnectionDecorator.java:155) at org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:186) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$RefCountConnection.prepareStatement(JDBCStoreManager.java:1639) at org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:175) at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.prepareStatement(PreparedStatementManagerImpl.java:289) at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushAndUpdate(PreparedStatementManagerImpl.java:112) at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushAndUpdate(BatchingPreparedStatementManagerImpl.java:81) at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(PreparedStatementManagerImpl.java:99) at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:87) ... 16 more Do not see changes with a single persistence unit in configuration. John >The main method that you are calling isn't a main line path that most (if >any) people go down. > > Do you have the property -Dopenjpa.jdbc.SynchronizeMappings=buildSchema [2] specified anywhere? That property will automatically create the necessary tables at runtime. > > If you're still having problems, I'd suggest putting together a coherent question and posting it back to the users mailing list. > > Thanks, > Rick > > [1] http://openjpa.apache.org/samples.html > [2] http://openjpa.apache.org/builds/2.0.0/apache-openjpa-2.0.0/docs/manual/manual.html#ref_guide_mapping_synch > >
