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
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
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
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
.
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
(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
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
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
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
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
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
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
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
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
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
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
.**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
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
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
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
)
@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
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
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
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 ?
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
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
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
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
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
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
...@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
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
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:
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
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
@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
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
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.
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.
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
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
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
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
.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
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
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
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
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?
/*
* 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;
/**
*
Hi,
Are there any Unit Tests for Custom Sequence Generator? I would like to
see it as example.
Regards,
Miro.
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
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
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
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
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
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
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
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
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
59 matches
Mail list logo