Re: Using a time UUID as a sequence

2014-03-20 Thread Rick Curtis
Todd - Honestly, I don't have much experience in this area. If you are able to put together a small unit test I'll try to take a look when I get some time. Thanks, Rick On Wed, Mar 19, 2014 at 10:05 PM, Todd Nine t...@spidertracks.com wrote: Just to follow up my own email, my configuration

Re: Using a time UUID as a sequence

2014-03-19 Thread Todd Nine
Thanks for the reply Rick. That does the trick for one field, but this class is used heavily throughout the model. If possible I'd like to create a custom field mapping, so that every time a UUID is encountered, this mapping happens automatically.I've created a custom field mapping. public

Re: Using a time UUID as a sequence

2014-03-19 Thread Todd Nine
Just to follow up my own email, my configuration in the persistence XML does work as expected. However, I'm receiving this error. Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: BLOB/TEXT column 'id' used in key specification without a key length {stmnt 992554479 CREATE TABLE

Using a time UUID as a sequence

2014-03-18 Thread Todd Nine
Hi all, We're migrating from a Key/Value system to MySQL for some components of our system for easier administration and maintenance. As part of this migration, we need to retain the time UUIDs that have been generated for primary keys. I'm having a hard time mapping this. I have the

Re: How to avoid ALTER SEQUENCE statement?

2013-11-08 Thread Heath Thomann
. The Sequence is defined as follows: CREATE SEQUENCE MY.OID_SEQ AS BIGINT START WITH 10 INCREMENT BY 1000 CYCLE CACHE 10; We were using identity columns earlier but switched to dedicated sequences to benefit from the ability to cache numerous ID values in advance

How to avoid ALTER SEQUENCE statement?

2013-10-17 Thread Meyer, Tobias
(strategy = GenerationType.SEQUENCE, generator = MY_OID_SEQ) @Column(name = OID) private long oid; OpenJPA’s NativeJDBCSeq class seems to have no trust in the developers using native sequences and issues an “ALTER SEQUENCE MY.OID_SEQ INCREMENT BY 1000” statement the first time an object gets

RE: How to avoid ALTER SEQUENCE statement?

2013-10-17 Thread Boblitz John
Hello Tobias, maybe I misunderstand, but is your sequence defined in the DB Table itself? If it is, I think your need to use the GenerationType.IDENTITY - if not, please disregard. Cheers, John -Original Message- From: Meyer, Tobias [mailto:tobias.me...@capgemini.com] Sent

RE: How to avoid ALTER SEQUENCE statement?

2013-10-17 Thread Meyer, Tobias
Hello John, you misunderstood. The Sequence is defined as follows: CREATE SEQUENCE MY.OID_SEQ AS BIGINT START WITH 10 INCREMENT BY 1000 CYCLE CACHE 10; We were using identity columns earlier but switched to dedicated sequences to benefit from the ability

Sequence Caching Failing in JTA Managed Environments with PostgreSQL

2013-08-06 Thread Scott Parkerson
About a year ago, there was a bug (OPENJPA-2196) that I contributed a patch to that deals with cases where OpenJPA's sequence caching cannot be used if the native sequence in the database is not owned by the role connecting to the database. This patch was included in OpenJPA 2.2.2. Since

Deadlock using sequence generator with limited connection pool

2012-08-20 Thread James Talbut
Hi, I have a data source defined as: bean id=dataSource class=org.apache.commons.dbcp.BasicDataSource destroy-method=close property name=driverClassName value=com.mysql.jdbc.Driver / property name=url value=${com.groupgti.esb.cxf.tracking.dataSource.url} / property

Re: Postgres sequence: current transaction is aborted

2012-06-20 Thread Kevin Sutter
Hi John, In this case, Marco was using a database Sequence, not the OpenJPA sequence table. There was an issue with having permissions to alter the Sequence with Postgres. Just wanted to clarify. Thanks! Kevin On Wed, Jun 20, 2012 at 12:57 AM, Boblitz John john.bobl...@bertschi.comwrote

AW: Postgres sequence: current transaction is aborted

2012-06-20 Thread Boblitz John
Hi Keven, Oh. The same GRANT will work though - no need to play with ownership. Cheers! John -Ursprüngliche Nachricht- Von: Kevin Sutter [mailto:kwsut...@gmail.com] Gesendet: Mittwoch, 20. Juni 2012 15:32 An: users@openjpa.apache.org Betreff: Re: Postgres sequence: current

Re: AW: Postgres sequence: current transaction is aborted

2012-06-20 Thread Marco de Booij
Hi Kevin, You answered for me but I want to clarify it for John. The GRANT SELECT, UPDATE, INSERT, DELETE only works for data in a table (For a sequence you only need SELECT and UPDATE). The solution in openJPA for the sequence involves a change in the definition of the SEQUENCE

Re: AW: Postgres sequence: current transaction is aborted

2012-06-20 Thread Kevin Sutter
it for John. The GRANT SELECT, UPDATE, INSERT, DELETE only works for data in a table (For a sequence you only need SELECT and UPDATE). The solution in openJPA for the sequence involves a change in the definition of the SEQUENCE. In PostgreSQL I have not found the way to grant this right so the user

Re: Postgres sequence: current transaction is aborted

2012-06-19 Thread Marco de Booij
Hello Kevin, Thanks for the help. Your work around solved my problem. I made my application user the owner of the sequence and I was able to insert my rows. I could not find how/if I could grant the rights. I hope that the 'final' solution works without this ALTER SEQUENCE statement. I

AW: Postgres sequence: current transaction is aborted

2012-06-19 Thread Boblitz John
You can set the permissions for the table with: GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE [SchemaName].openjpa_sequence_table TO [UserName]; *NOTE: This Sequence Table was autogenerated by openJPA - you name might be different! John -Ursprüngliche Nachricht- Von: Marco de

Re: Postgres sequence: current transaction is aborted

2012-06-18 Thread Kevin Sutter
.**EAGER) @JoinColumn(name=CODE_ID) @OrderBy(id.taalKode ASC) private ListI18nCodeTekstDto teksten = new ArrayListI18nCodeTekstDto(); The class has the getters and setters that are needed. The user that connects to the datasource has access to the sequence and the tables. I get the error

Re: Postgres sequence: current transaction is aborted

2012-06-18 Thread Marco de Booij
ERROR: must be owner of relation seq_i18n_codes 2012-06-18 20:17:28 CEST STATEMENT: ALTER SEQUENCE DOOS.SEQ_I18N_CODES INCREMENT BY 50 2012-06-18 20:17:28 CEST ERROR: current transaction is aborted, commands ignored until end of transaction block 2012-06-18 20:17:28 CEST STATEMENT: SELECT

Re: Postgres sequence: current transaction is aborted

2012-06-18 Thread Marco de Booij
I searched further. Somebody mentioned to add allocationSize=1 to the @SequenceGenerator but this did not solve the problem. I now get a simple alter sequence statement that looks like the problem (OPENJPA-2196) Create Sequence Postgres 9.1. Hope that this helps you a bit more. 2012-06-18 22

Re: Postgres sequence: current transaction is aborted

2012-06-18 Thread Kevin Sutter
Hi Marco, The trace from Postgres is helping to understand the issue. I think the basic problem is that the application doesn't have proper permissions to update (alter) the sequence: 2012-06-18 20:17:28 CEST ERROR: must be owner of relation seq_i18n_codes 2012-06-18 20:17:28 CEST STATEMENT

Postgres sequence: current transaction is aborted

2012-06-17 Thread Marco de Booij
) @OrderBy(id.taalKode ASC) private ListI18nCodeTekstDto teksten = new ArrayListI18nCodeTekstDto(); The class has the getters and setters that are needed. The user that connects to the datasource has access to the sequence and the tables. I get the error when I try to persist the object

Re: sequence

2012-03-12 Thread Mansour Al Akeel
ok, not much details. Let me add some. Everytime, I insert a record, I want the sequence number to increment by one. For example: count( entities with invoiceId) + 1 With constraints that the combination should be unique. My question is, does something like this exist or I have to implement

Re: sequence

2012-03-12 Thread Rick Curtis
I suspect you'll need to write a custom generator. Thanks, Rick On Mon, Mar 12, 2012 at 8:26 AM, Mansour Al Akeel mansour.alak...@gmail.com wrote: ok, not much details. Let me add some. Everytime, I insert a record, I want the sequence number to increment by one. For example: count

sequence

2012-03-09 Thread Mansour Al Akeel
I have an entity InvoiceItem. I need to be able to generate the table as in: invoiceId    seq more fields 1              1 1 2 1 3 2 1 2 2 2 3 2 4 Is there a way to do it in JPA 2.0 ?

OpenJPA does not read default schema from orm.xml for TableGenerator-specified sequence table

2011-08-26 Thread Laird Nelson
schema when working with the sequence table described by my @TableGenerator annotation. IMHO it should. See the stack: openjpa-2.1.0-r422266:1071316 fatal general error org.apache.openjpa.persistence.PersistenceException: Table JPA_SEQUENCE not found; SQL statement: SELECT LAST_VALUE FROM

Re: OpenJPA Sequence Generation in HSQLDB broken?

2011-04-07 Thread Miłosz Tylenda
Hi Lennart, You are using an in-memory database and shutdown=true in the URL. This causes the database be shut down when the last connection terminates. I guess that what's happening here is the sequence is created, then the connection terminates and when a new connection starts you

OpenJPA Sequence Generation in HSQLDB broken?

2011-04-06 Thread Lennart Jörelid
Hello there, I am trying to make automated JPA integration tests using OpenJPA and HSQLDB. The entities use automated IDs generated with Database Sequences, as shown in the entity code snippets below. However, I encounter strange behavior when running unit tests - the OpenJPA-generated Sequence

Re: OneToMany cascading persist and sequence ID generator

2011-03-03 Thread Jeremy Bauer
to reproduce the problem. -Jeremy On Wed, Mar 2, 2011 at 11:08 AM, Phill ph...@bicispace.com wrote: Yes it also uses a sequence generator. SurveyAnswer.java @SequenceGenerator(name = Survey_Result_Id_Gen, sequenceName = survey_result_seq, allocationSize = 10) @Id

OneToMany cascading persist and sequence ID generator

2011-03-02 Thread Phill
I'm having some problems with a cascading @OneToMany persist, my class with the @ManyToOne has a sequence id generator and this Id is not getting populated in the cascaded entity. Here are the relevant snippets: Lead.java -- @SequenceGenerator(name = Lead_Id_Gen

Re: OneToMany cascading persist and sequence ID generator

2011-03-02 Thread Jeremy Bauer
with the @ManyToOne has a sequence id generator and this Id is not getting populated in the cascaded entity. Here are the relevant snippets: Lead.java -- @SequenceGenerator(name = Lead_Id_Gen, sequenceName = lead_id_seq) @Id @GeneratedValue(strategy = GenerationType.SEQUENCE

Re: OneToMany cascading persist and sequence ID generator

2011-03-02 Thread Phill
...@bicispace.com wrote: I'm having some problems with a cascading @OneToMany persist, my class with the @ManyToOne has a sequence id generator and this Id is not getting populated in the cascaded entity. Here are the relevant snippets: Lead.java

Re: OneToMany cascading persist and sequence ID generator

2011-03-02 Thread Phill
Yes it also uses a sequence generator. SurveyAnswer.java @SequenceGenerator(name = Survey_Result_Id_Gen, sequenceName = survey_result_seq, allocationSize = 10) @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = Survey_Result_Id_Gen) @Column(name = result_id) protected long

Sequence Generator on a non ID field

2011-02-23 Thread David Beer
Hi all I am trying to get a value for a field set when commited to the db, to be auto generated. This field is not an ID for the table. I seem to get the error message InvalidStateException: Can only perform operation while a transaction is active. My class looks like the following:

Re: Sequence Generator on a non ID field

2011-02-23 Thread David Beer
wrote: Hi From a bit more research it seem @GeneratedValue can only be used with @Id. If this is the case what is the best way to insert auto generated data based on a sequence and the previous number. David

Re: Sequence Generator on a non ID field

2011-02-23 Thread Michael Dick
is the best way to insert auto generated data based on a sequence and the previous number. David On Wed, 2011-02-23 at 15:56 +, David Beer wrote: Hi Mike This is the full stack trace. openjpa

Re: Sequence Generator on a non ID field

2011-02-23 Thread David Beer
@GeneratedValue can only be used with @Id. If this is the case what is the best way to insert auto generated data based on a sequence and the previous number. David

implicit sequence

2010-09-27 Thread mpf
Hi there! Is it possible to map an implicit sequence with jpa? for example: @Id @SequenceGenerator(name = SEQ_GEN_T_STAAT, sequenceName = SEQ_T_STAAT) @GeneratedValue(generator = SEQ_GEN_T_STAAT, strategy = GenerationType.SEQUENCE) @Transient private

Re: implicit sequence

2010-09-27 Thread mpf
argh.. shame on me, just need @GeneratedValue(strategy = GenerationType.IDENTITY) -- View this message in context: http://openjpa.208410.n2.nabble.com/implicit-sequence-tp5574006p5574070.html Sent from the OpenJPA Users mailing list archive at Nabble.com.

Insert/Update sequence in an Object tree

2010-03-01 Thread JayaPrakash
be inserted first and then B and C or C first, then B and A at last. Thanks, JP -- View this message in context: http://n2.nabble.com/Insert-Update-sequence-in-an-Object-tree-tp4657147p4657147.html Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: 'Standalone' Sequence Generator

2009-02-12 Thread is_maximum
Hi We were able to improve the performance a bit but still far way to go. Some changes in code and creating index in database help us more. But still we have problem in batch limit. At first, I had set it to -1 that ends up in a weird OptimisticLockException in all persist methods and then I

Re: 'Standalone' Sequence Generator

2009-02-12 Thread Kevin Sutter
Hi, Some comments below, but I don't have a complete answer to your enhancement questions yet... On Thu, Feb 12, 2009 at 6:38 AM, is_maximum mnr...@gmail.com wrote: Hi We were able to improve the performance a bit but still far way to go. Some changes in code and creating index in database

Re: 'Standalone' Sequence Generator

2009-02-12 Thread is_maximum
Thanks Kevin, again a complete answer first let me tell you that I was able to solve the problem of build-time enhancement, both environment are the same but don't know why in my computer it was able to find persistence.xml and in other computer was not! any way I define the path to

Re: 'Standalone' Sequence Generator

2009-02-02 Thread Miłosz Tylenda
Norbert, There is no such standalone TableGenerator in JPA but some solution to this has been recently posted here: http://n2.nabble.com/Access-Oracle-Sequence-using-OpenJPA-tp2227943p2227943.html Hope this helps. Greetings, Milosz Hi, for some reason I need a sequence generator, used

Re: 'Standalone' Sequence Generator

2009-02-02 Thread Kevin Sutter
.nabble.com/Access-Oracle-Sequence-using-OpenJPA-tp2227943p2227943.html Hope this helps. Greetings, Milosz Hi, for some reason I need a sequence generator, used to create unique keys explicitly. Is there any kind of standalone TableGenerator available in JPA ? What I want to do

'Standalone' Sequence Generator

2009-02-02 Thread Norbert Rieger
Hi, for some reason I need a sequence generator, used to create unique keys explicitly. Is there any kind of standalone TableGenerator available in JPA ? What I want to do is something like that: TableGenerator genId = new TableGenerator (em, XX) ; Long next = genId.getNext

Access Oracle Sequence using OpenJPA

2009-01-27 Thread get_it_done
My environment: JBOSS 4.2.1, OpenJPA 1.1, Java 5, EJB 3 (+JPA), Oracle 10g I need to access custom Oracle Sequence using OpenJpa. Only need the next value from the sequence. I dont need to slap that next value as id on any entity. SELECT SEQ.NEXTVAL from dual; Most probably create a DAO

Re: ReportingSQLException: library routine called out of sequence

2008-01-02 Thread Marc Siegel
Caused by: openjpa-1.0.1-r420667:592145 nonfatal general error org.apache.openjpa.persistence.PersistenceException: library routine called out of sequence {prepstmnt 10862362 UPDATE ExSubject SET exSynchronizedAt = ? WHERE id = ? [params=(Timestamp) 2008-01-02 14:39:16.935, (long) 3]} [code=0

Re: ReportingSQLException: library routine called out of sequence

2008-01-02 Thread Marc Siegel
Hi Gokhan, Well we may be on the right track here. My application is single-threaded, I never create any threads. Does that lead to any other thoughts of where threading may intrude periodically and seemingly randomly? Is there connection pooling / threadpooling in the JDBC layer of openjpa?

Re: Error instantiating named sequence test.DataObjectsGenerator

2007-12-17 Thread Miroslav Nachev
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package test; import java.math.BigDecimal; import org.apache.openjpa.jdbc.kernel.NativeJDBCSeq; import org.apache.openjpa.kernel.StoreContext; import org.apache.openjpa.meta.ClassMetaData; /** *

Unit Tests for Custom Sequence Generator

2007-12-17 Thread Miroslav Nachev
Hi, Are there any Unit Tests for Custom Sequence Generator? I would like to see it as example. Regards, Miro.

Re: Error instantiating named sequence test.DataObjectsGenerator

2007-12-17 Thread Miroslav Nachev
I do not want to use lastInsertId or similar. I would like to use my own Sequence generator. Can somebody show me one working example or JUnit test with Custom Sequence generation using OpenJPA? Miro. Gokhan Ergul wrote: Miroslav Nachev wrote: When I do the following initial changes

Re: Error instantiating named sequence test.DataObjectsGenerator

2007-12-17 Thread Gokhan Ergul
Miroslav Nachev wrote: I do not want to use lastInsertId or similar. I would like to use my own Sequence generator. Can somebody show me one working example or JUnit test with Custom Sequence generation using OpenJPA? Miro. Well, the only database supported mechanism (for mysql) to create

Re: Error instantiating named sequence test.DataObjectsGenerator

2007-12-16 Thread Patrick Linskey
Hi, Does DataObjectsGenerator extend NativeJDBCSeq? The error is happening because NativeJDBCSeq's endConfiguration() method enforces that a string for finding the next sequence value is available for it to use. Presumably, our MySQL dictionary does not have a default next-sequence SQL string

Error instantiating named sequence test.DataObjectsGenerator

2007-12-15 Thread Miroslav Nachev
Hi, I am using MySQL with SnapShot OpenJPA and would like to create my own Sequence Generator. I am implemented interface "Seq" and when start the application I have the following error: openjpa-1.1.0-SNAPSHOT-r420667:603666M fatal store error org.apache.openjpa.persistence.Rollbac

Re: Unique constraint violated using Oracle sequence to generate ID only when multi-threaded.

2007-12-12 Thread frankca
FYI: I opened the issue# OPENJPA-466 frankca wrote: Hi, First, I understand the following is thread-safe which I mean OpenJPA always asks the database sequence for the next value: @Id @SequenceGenerator(name = FooSeq, sequenceName = seq_foo) @GeneratedValue(strategy

RE: Incorrect IDENTITY sequence name in PostgreSQL

2007-10-24 Thread Ryosuke IWATA (DM)
Subject: Re: Incorrect IDENTITY sequence name in PostgreSQL Hi Ryosuke, Which version of OpenJPA are you using? Unless you're using a very recent snapshot you should see something like this (unless you've changed the logging level) : 12 test INFO [main] openjpa.jdbc.JDBC - Using

Incorrect IDENTITY sequence name in PostgreSQL

2007-10-23 Thread Ryosuke IWATA (DM)
sequence for the column ENTITYID is named : X_SCHOOL_TRANSFER_EVENT_ENTITY_ID_SEQ When you EntityManager#persist() a new instance of SchoolTransferEvent, you will get an exception as follows: org.apache.openjpa.lib.jdbc.ReportingSQLException: ERROR: relation

Re: sequence per entity

2007-08-23 Thread Patrick Linskey
sequence object rather than a table. I took your advice and created a custom ClassTableNativeJDBCSeq class that uses a sequence per entity table (not entity class) I think it would be great of openjpa would give this support out-of-the-box (at least then it would probably have a short alias

Re: sequence per entity

2007-08-16 Thread Gene Wu
I think there is no possibility to have different sequence with the standard OpenJPA. If this requirement is critical one, and you don't care to have a customized version of OpenJPA. My initial thought is a sequence plug-in, you can check org.apache.openjpa.jdbc.conf.JDBCSeqValue as a reference