Re: openjpac lots of questions

2009-09-08 Thread Tedman Leung
> 1. .java or .class files ? > > that openjpac enhancer works on .java files. > > I thought it works on .class files ... can one clarify that point ? > > In other words, should I have .java (source folder) or .class (dest > folder after compile) here ? > > > it can at leas

Re: OPENJPA_SEQUENCE_TABLE created unnecessarily for embeddable classes

2009-05-04 Thread Tedman Leung
There was already a previous thread on this although I can't seem to find it off hand. I think some one was looking into it already so there might be a jira openned. On Mon, May 04, 2009 at 09:53:41AM -0500, Michael Dick wrote: > Hi Martin, > > I think it's worth a JIRA (otherwise it'll get lo

Re: OPENJPA_SEQUENCE_TABLE: needed even with IDENTITY columns?

2009-04-21 Thread Tedman Leung
In another project I work on, I have exactly this usage (well with Integer) @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id=null; and with this project, I do not get the sequence table. > On Mon, Apr 20, 2009 at 5:18 PM, Pinaki Poddar (via Nabb

Re: OPENJPA_SEQUENCE_TABLE: needed even with IDENTITY columns?

2009-04-20 Thread Tedman Leung
I should briefly mention that I had the same problem using the MySql database. I'm sure I'm not using the SEQUENCE table because I manually created my database tables and I was just migrating to using the schema generator. In my case it was tracked down to using an @EmbeddedId in the model clas

Re: detachment of fetch-groups doesnt work

2009-04-09 Thread Tedman Leung
.logemann.org > http://www.logentis.de > > > > > Am 08.04.2009 um 23:50 schrieb Tedman Leung: > >> just as additional information, this is also true about any lazy >> PersistentCollection too. I found that if I accessed the collection >> while >> it is in an

Re: detachment of fetch-groups doesnt work

2009-04-08 Thread Tedman Leung
just as additional information, this is also true about any lazy PersistentCollection too. I found that if I accessed the collection while it is in an attached state the values are available, but as soon as it becomes detached the collection becomes null even if I had just accessed it prior to

Re: Eager fetching of PersistentCollection gives error (solution OPENJPA-1020)

2009-04-03 Thread Tedman Leung
Collections can contain. > > On 4/2/2009 7:49 AM, Tedman Leung wrote: >> that is correct, if I leave out the fetch type, it defaults to lazy and >> it works fine (so long as the entity is in an attached state). >> >> The other observation I noticed is that accessing

Re: Eager fetching of PersistentCollection gives error

2009-04-02 Thread Tedman Leung
he > Set is large or if there a large number of these Set objects that are > frequently loaded. Or does OpenJPA wrap these non-entity persistent > elements into some kind of runtime pseudo-Entity (also expensive and > might not resolve all of these issues)? > > - Paul >

Eager fetching of PersistentCollection gives error

2009-04-01 Thread Tedman Leung
So I have a more clear picture of this error now. Quite simply eager fetching of a persistent collection of strings fails. as an example : @PersistentCollection(fetch=FetchType.EAGER) private HashSet testStrings=new HashSet(); Just create the entity, add a string to the collecti

Re: how to store collection of enums as strings

2009-03-31 Thread Tedman Leung
not as a reference to other entities, is that correct? > > If so, wouldn't a combination of @PersistentCollection and Externalization > (section 6.6 in the manual) provide the function you are looking for? > > > On Wed, Mar 25, 2009 at 11:48 AM, Tedman Leung wrote: > &g

Re: how to store collection of enums as strings

2009-03-31 Thread Tedman Leung
foreign key > which is how a Collection maps into the world of relational databases > whether you are using straight JDBC or JPA or Hibernate or brand X ORM. > In the end you wind up with two database tables and two objects that > model the association. > > - Paul > >

Re: how to store collection of enums as strings

2009-03-31 Thread Tedman Leung
n 3/30/2009 9:47 AM, Tedman Leung wrote: >>> Isn't the same thing true that OneToMany should annotate a Collection >>> of Entities? So the Enums would be a field on the ManyToOne side of >>> that kind of mapping. Then you can specify the @Column and >>&

Re: how to store collection of enums as strings

2009-03-30 Thread Tedman Leung
Column(nullable=false, length=32) style annotation. >> >> I think the problem is much bigger and wide spread than I originaly though, >> I don't think I'll be able to sort out a patch. >> >> >> On Sun, Mar 29, 2009 at 07:55:06AM -0700, Tedman Leung wrote: &

Re: how to store collection of enums as strings

2009-03-29 Thread Tedman Leung
un, Mar 29, 2009 at 07:55:06AM -0700, Tedman Leung wrote: > yes I know I can do manual hacks to get them stored the way I want to, but > I was asking if there was a jpa / openjpa annotation to allow that. > > As an example, I can just use @Enumerated on a single enum, so it seems &

bug in @PersistentCollection(fetch=FetchType.EAGER)

2009-03-29 Thread Tedman Leung
I think I've found a bug in @PersistentCollection(fetch=FetchType.EAGER) when used with Strings. It just doesn't seem to retrieve. This only happens with FetchType.EAGER and it only happens if the entity is being loaded from the database / not cached via openjpa.DataCache. (If I create the ent

Re: how to store collection of enums as strings

2009-03-29 Thread Tedman Leung
have add these Enums to the collection one at a time. > You can use an addEnum() method or an Entity listener to convert them to > Strings at that point one at a time. And a subclass of the Collection > type to getEnum() from the Collection when you fetch them back. > > new MySt

Re: how to store collection of enums as strings

2009-03-28 Thread Tedman Leung
> > On 3/28/2009 1:33 PM, catalina wei wrote: >> Ted, >> If you are using Java 5, then you could use name() or toString() API on the >> Enum to get the name of the enum constant in String value. >> >> Catalina >> >> On Wed, Mar 25, 2009 at 9:48 AM, Tedman L

how to store collection of enums as strings

2009-03-25 Thread Tedman Leung
Anyone know how to store a collection of enums as Strings instead of their ordinal values? (preferably with annotations...) i.e. @ManyToMany private Set myEnums=new HashSet(); -- Ted Leung

persisting collections of enums as strings

2009-03-20 Thread Tedman Leung
Hi I'm trying to persista a Collection of Enums in string format and I can't seem to find much information on how to do this. There were some things that said it defaults to String but when I generated the tables (using the MappingToolTask) it comes out as a number column. i.e. public

Re: OpenJPA-1.2.0: SchemaToolTask does not have "dropTables" argument

2009-03-10 Thread Tedman Leung
Incidentally, with the MappingToolTask, if you use schemaAction="dropDB", at least in MySql, you don't get a drop DB command, you get drop table commands, which sounds like what you're trying to do. I don't know if this applies to the schemaTool or what the difference between the MappingTool an

MappingTool and spring configuration

2009-02-26 Thread Tedman Leung
Does anyone know of a good way to use the mapping tool with a spring configuration for schema generation? My main configuration is all done through spring, i.e. my persistence.xml looks like http://java.sun.com/xml/ns/persistence"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

Re: poor performance

2008-09-05 Thread Tedman Leung
that's not entirely true, a lot of resources are loaded at the last minute, not necessarily when you think you initialised the call. what I normally do if I'm trying to do a micro-benchmark like this is to send the operation into something like a 110 time loop and only count the times of the la

Anomalie in default optimistic locking in 1.1.0

2008-06-10 Thread Tedman Leung
I've encountered an anomalie with the optimistic locking. OpenJpa 1.1.0 : from repo1.maven.org Jdk : java full version "1.6.0_06-b02" Spring 2.5.4 compile time enhancement using org.apache.openjpa.ant.PCEnhancerTask ant task The issue is that if I call merge() on an object after changing a val

Re: maven dependencies

2008-06-04 Thread Tedman Leung
I should add, that I posted an email just recently noting that the openjpa maven repositories in repo1.maven.org appear to be broken as there's dependent items which are missing. I never heard back so I don't think anyones actually fixing it or anything. I just tried openjpa from maven again r

maven2 repository and poms

2008-05-29 Thread Tedman Leung
Hi I just noticed that some one recently removed the openjpa 1.1.0 snapshot repositories and published then in the main repositories as non-snapshots (i.e. http://repo1.maven.org/maven2/org/apache/openjpa/openjpa/1.1.0) I'm having a problem with it in that the pom in openjpa/1.1.0 appears to

Re: update always called on commits (still)

2008-05-07 Thread Tedman Leung
sus non-enhanced OpenJPA? > > > > Tedman Leung on 07/05/08 22:01, wrote: > >I eventually did compile time enhancement (as the agent was way too > >problemmatic) and yeah all my problems went away. Thanks for the info. > > > > > > > >On Wed, May 07, 2008 at 11:35

Re: update always called on commits (still)

2008-05-07 Thread Tedman Leung
I eventually did compile time enhancement (as the agent was way too problemmatic) and yeah all my problems went away. Thanks for the info. On Wed, May 07, 2008 at 11:35:55AM -0700, Tedman Leung wrote: > Well according to the documentation "unenhanced" will become enhanced at

Re: update always called on commits (still)

2008-05-07 Thread Tedman Leung
> your app. > > 2. runtime enhancement - giving the "-javaagent=openjpa.jar" argument to > the JVM when you run your app. > > 3. unenhanced - neither 1 nor 2. > > Have you observed this problem in all three scenarios? Just (2) or (3)? > > Tedman Leung wrote

Re: update always called on commits (still)

2008-05-07 Thread Tedman Leung
> If you're sure you're enhancing (correctly; not e.g. having Eclipse > overwrite your .class), this is surely something else; sorry. > > > -Original Message- > From: Tedman Leung [mailto:[EMAIL PROTECTED] > Sent: mercredi, 7. mai 2008 19:12 > To: users@o

update always called on commits (still)

2008-05-07 Thread Tedman Leung
Hi while back we had a discussion on updates (or more specifically preupdates) always being called even when no changes where made. I noticed there was an issue OPENJPA-506 openned for this and currently closed - but this still occurs. Both anotated @PreUpdate methods as well as updates are alw

Re: InvalidStateException

2008-04-29 Thread Tedman Leung
my guess is that it means you haven't started a transaction yet. have you? > I get this message when trying to persist an Entity: > > Exception in thread "AWT-EventQueue-0" user error> org.apache.openjpa.persistence.InvalidStateException: Can only > perform operation while a transaction is ac

Re: currencies

2008-04-25 Thread Tedman Leung
when I use enums it just saves the instance name i.e. USD not TradeCurrency.USD I believe it stores the enum.getName() call. > From googling and a quick scan of the mailing list archives, it looks as if > I can't map java.util.Currency directly to a database column using pure JPA. > > Unless

Re: Error in Configuration?

2008-03-12 Thread Tedman Leung
why not post your persistence.xml or what ever you're using to configure the connections so we see. On Wed, Mar 12, 2008 at 05:09:11PM -0700, Jacques Belissent wrote: > Hi, > > Referring to: > http://mail-archives.apache.org/mod_mbox/openjpa-users/200712.mbox/[EMAIL > PROTECTED] > > I am als

Re: Newly null fields not being persisted?

2008-03-07 Thread Tedman Leung
I reported this as a bug earlier and I never heard back, it still occurs. A more detiled explanation of what I found is as follows : - If you have a new entity with null fields, the fields will save as null. - If you have an entity which is attached, you can nullify fields as long as it persis

Re: Persistence of Enum values

2008-02-22 Thread Tedman Leung
have a look at the manual secion 8.1.2 generally speaking everything works as you'd expect it. I've been using it quite a bit with out any problems. On Fri, Feb 22, 2008 at 03:39:03PM -0600, Alexander Saint Croix wrote: > Hello, > > Is there documentation available about persisting enumeration

entityManager.merge() with Calendar fields, can not set value to null (test code included)

2007-12-21 Thread Tedman Leung
Hi it looks like I've found a bug where if you have an entity with a Calendar field, and you set the value to null (from a non-null value) and you use entityManager.merge() to store the state back to the database, nothing happens. Not this only happens if you call merge(), if you set it to null

Re: @PreUpdate always called? (Attached maven / eclipse test case)

2007-12-20 Thread Tedman Leung
okay so the mail-list won't let me send the test case as an attachment so here are the files individually : - Attached is a simple test that shows both @PreUpdate and @PostUpdate are called even when nothing is done at all. - It requires maven2. - I used jdk1.6 (but not required, m

Re: @PreUpdate always called?

2007-12-20 Thread Tedman Leung
I'm not entirely sure it's a problem with "your spring transaction usage". I have the exact same problem although I'm also using springs transactions, I'm using the spring annotated transactions. I find that if I just call entityManager.find() on an object that once the transaction completes i

Re: @Enumerated (EnumType.STRING) - select query returns NULL values

2007-12-17 Thread Tedman Leung
you could try a newer version of openJpa, I used the 1.0 and currently the 1.1 snapshot versions and I haven't had those problems and I've done the exact same thing, enumeration to string. > Found the answer in other threads. Looks like by default LAZY fetching > is used for @Enumerated (I don't

Re: Persistent collection

2007-11-14 Thread Tedman Leung
okay with the latest nightly build it works but, how do you specify the column name you want to use? @Column(name = "myColumn") no longer works, it complains about Caused by: org.apache.openjpa.persistence.ArgumentException: You have supplied columns for "com..dao.Item.itemCategoryId

Re: Merging an object

2007-11-14 Thread Tedman Leung
oops sorry ignore what I said, I'm not awake yet. > It's my understanding that you shouldn't be calling setId(5) if you're using > @generated, the annotation means the id is generated and not set by you isn't > it? > > > Hi all, > > > > I have a basic problem with openjpa 1.0.0. Merging and ob

Re: Persistent collection

2007-11-14 Thread Tedman Leung
thanx. > That's not new enough; per > https://issues.apache.org/jira/browse/OPENJPA-417?page=com.atlassian.jira.plugin.ext.subversion:subversion-commits-tabpanel, > it needs to be 592917 or newer. > > -Patrick > > On Nov 14, 2007 9:57 AM, Tedman Leung <[EMAIL

Re: Merging an object

2007-11-14 Thread Tedman Leung
It's my understanding that you shouldn't be calling setId(5) if you're using @generated, the annotation means the id is generated and not set by you isn't it? > Hi all, > > I have a basic problem with openjpa 1.0.0. Merging and object results in > this exception: > > > org.apache.openjpa.pe

Re: Persistent collection

2007-11-14 Thread Tedman Leung
I've tried @PersistentCollection with a recent openjpa-1.1.0-SNAPSHOT-r420667:570593 and it doesn't appear to work with Integers. Declaration @PersistentCollection(fetch=FetchType.EAGER) @ContainerTable(name="ItemItemCategory", [EMAIL PROTECTED](name="itemId")) @Column(name=

native queries are select only?

2007-11-11 Thread Tedman Leung
So I read the previous explanation which says "Native queries can only be SELECT statements per the spec; OpenJPA assumes that if they don't start with SELECT, they're stored procedures. That's what's causing the error." Could some one let me know what page of the spec says that? cuz I download