openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diego Cattelan <netman...@libero.it>
Subject Problem with database schema creation
Date Thu, 09 Sep 2010 18:43:33 GMT

 Please help a JPA primer

- JDK 1.6.0_21
- OpenJPA 2.0.1
- FirebirdSQL 2.1.3 + Jaybird 2.1.6

I manually created a new empty database.
I have only 1 entity :
-----------------------------------------------------------------------------
@Entity
public class ana_anagrafica implements Serializable {
    private static final long serialVersionUID = 1L;

    private Long id;

    @Id
    @GeneratedValue(strategy =
GenerationType.SEQUENCE,generator="ANA_ANAGRAFICA_GEN")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
}
--------------------------------------------------------------------------------

on persistence.xml :

<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>

but when i run the application I get the exception

1161  it.diegocattelan.ninphea-persistence  TRACE  [mod_BootModule_2]
openjpa.jdbc.JDBC - Initial connection autoCommit: false, holdability: 2,
TransactionIsolation: 2
1218  it.diegocattelan.ninphea-persistence  TRACE  [mod_BootModule_2]
openjpa.jdbc.JDBC - <t 30303902, conn 28523022> [50 ms] close
9-set-2010 19.32.56 it.ninphea.boot.BootController moduleInit
GRAVE: null
<openjpa-2.0.1-r422266:989424 fatal user error>
org.apache.openjpa.persistence.ArgumentException: Could not locate the
sequence with name "ANA_ANAGRAFICA_GEN".  It is possible that the metadata
file c
ontaining the sequence has not been parsed yet.  Make sure to use a
persistent class whose metadata is in the same file somewhere in your
application before requesting the sequence.
        at
org.apache.openjpa.meta.MetaDataRepository.getSequenceMetaDataInternal(MetaDataRepository.java:2105)
        at
org.apache.openjpa.meta.MetaDataRepository.getSequenceMetaData(MetaDataRepository.java:2090)
        at
org.apache.openjpa.meta.MetaDataRepository.getSequenceMetaData(MetaDataRepository.java:2117)
        at
org.apache.openjpa.meta.FieldMetaData.getValueSequenceMetaData(FieldMetaData.java:1052)
        at
org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:623)
        at
org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:597)
        at
org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:484)
        at
org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:456)
        at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:155)
        at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:159)
        at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:117)
        at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)
        at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
        at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
        at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
        at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
        at it.ninphea.boot.BootController.moduleInit(BootController.java:68)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
it.diegocattelan.services.application.modules.proxy_spi.ModuleThread.elaboraEventoDiSistema(ModuleThread.java:238)
        at
it.diegocattelan.services.application.modules.proxy_spi.ModuleThread.elaboraEvento(ModuleThread.java:301)
        at
it.diegocattelan.services.application.modules.proxy_spi.ModuleThread.run(ModuleThread.java:184)

if I manually create the sequence the error doesn't change.

Any hint ?
Thank you 
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Problem-with-database-schema-creation-tp5515628p5515628.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message