Re: Loading relations

2023-04-16 Thread Mark Struberg
Can you probably create a small sample project with the entities + a small unit 
test?
That way we can make sure to really talk about exactly the same scenario.

txs and LieGrue,
strub

> Am 23.03.2023 um 18:16 schrieb Marco DE BOOIJ :
> 
> I searched on the web but cannot filter out the solution. I get pointed to 
> Spring and Hibernate but I am only interested in the solution with OpenJPA.
> I have a table in which I store the taxonomy tree. The key is the TAXON_ID 
> and it is linked with its parent through the PARENT_ID. I created the 
> following DTO named TaxonDto (I left out the fields that are of no 
> importance):
> 
>   @Column(name="PARENT_ID")
>   private Long  parentId;
>   @Column(name="RANG", length=3, nullable=false)
>   private Stringrang;
>   @Id
>   @GeneratedValue(strategy=GenerationType.IDENTITY)
>   @Column(name="TAXON_ID", nullable=false, unique=true, updatable=false)
>   private Long  taxonId;
> 
>   @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, 
> targetEntity=TaxonnaamDto.class, orphanRemoval=true)
>   @JoinColumn(name="TAXON_ID", nullable=false, updatable=false, 
> insertable=true)
>   @MapKey(name="taal")
>   private Map taxonnamen  = new HashMap<>();
> 
>   @OneToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY, 
> targetEntity=TaxonDto.class, orphanRemoval=true)
>   @JoinColumn(name="PARENT_ID", referencedColumnName="TAXON_ID", 
> updatable=false, insertable=false)
>   private TaxonDto  parent;
> 
> My problem lies in the @OneToOne. I did a test with FetchType.EAGER but then 
> the size of the returned data is 3x bigger as with LAZY since I get all 
> parents below the taxon. What I want is that the parent is fetched when the 
> rang is a specific value namely 'oso'. I can live with a solution where the 
> parent is not recursivly filled, the parent of the parent in this DTO must be 
> null.
> 
> Is this possible and if so how can I do this? I have seen discriminators, 
> fetchgroup and subclass DTO but it leaves me clueless.
> 



Re: OpenJPA 3.2.0 with Java 16

2021-09-30 Thread Mark Struberg
Hi Rob! 

It's even a bit more complicated. During the javax -> jakarta spec migration we 
found a few javax packages which will remain in the JDK and thus remain to keep 
the javax package name. The javax.transaction.xa is one of those. It is also 
not part of the official jakarta jta packages. Thus I'd say we should also 
remove this package from the geronimo specs jar and roll a new release. Just 
checked that the xa package is also part of Java 17 still.

LieGrue,
strub



> Am 28.09.2021 um 18:11 schrieb Rob Scala :
> 
> Hi Everyone,
> 
> I hope I have the right mailing list.
> 
> I'm working on upgrading from java 8 to java 16, and updating dependencies in 
> the process.  My project is modular.  I hit a stumbling block with a split 
> package:
> 
> module X reads package javax.transaction.xa from both 
> org.apache.geronimo.specs.geronimo.jta.spec and java.transaction.xa
> 
> where X is a lot of different modules, including apache commons, awssdk, 
> jersey, etc.
> 
> I understand that this error is caused by a core java module 
> (java.transaction.xa) and a geronimo.jta module both containing classes in 
> the packate "javax.transaction.xa".  That is not allowed in modular projects. 
>  Since the geronimo module is required by OpenJPA, I tried excluding the core 
> java module, but that didn't work, and I don't know if it even should work.
> 
> Has anyone used OpenJPA in a modular project?  Is there a solution for this?
> 
> Thanks a bunch!
> 
> Rob Scala
> 



Re: please help with untime trouble while loading XML (org.xml.sax.SAXException)

2021-03-18 Thread Mark Struberg
Hi! Does it help if you remove it for now? Should not go grab some xsd from 
remote somewhere tbh.
If we do, then it's a bug!

LieGrue,
strub

> Am 15.03.2021 um 19:21 schrieb Patrice Duroux :
> 
> 
> Hi,
> 
> For the past few weeks, OpenJPA has not been able to systematically
> iniitialize loading the persistence.xml file or to perform the classes
> enhancement due to problem accessing the .xsd files on the Oracle server.
> Is there a way to avoid that? Embedding the required .xsd files as Java
> resources?
> Inactivating this SAX validation using a property?
> 
> Many thanks,
> Patrice
> 
> 
> 
> --
> Sent from: http://openjpa.208410.n2.nabble.com/OpenJPA-Users-f208411.html



Re: CriteriaUpdate/CriteriaDelete support?

2020-12-28 Thread Mark Struberg
Hi Pawel, thanks for the report. 

I hope I find some time to address that soonish.
Did you create a ticket for it already?

txs and LieGrue,
strub


> Am 24.12.2020 um 09:57 schrieb Pawel Veselov :
> 
> Hello.
> 
> I was rather excited when I saw the statement on
> http://openjpa.apache.org/ that 3.x releases "target" the 2.2 JPA
> Spec, but are *compatible* with specs 2.1 and below specs, sort of
> reading it as 3.x supporting 2.2 spec.
> 
> My excitement was crushed with a rather heavy boulder once I saw that
> the criteria builder simply throws an unsupported operation exception
> in methods to create criteria update/delete objects.
> 
> How far away is OpenJPA from implementing the full 2.2 spec,
> especially these update/delete criteria support?
> 
> -- 
> With best of best regards
> Pawel S. Veselov



[ANN] Apache OpenJPA-3.1.2 released

2020-09-07 Thread Mark Struberg
The Apache OpenJPA team is pleased to announce the release of Apache OpenJPA 
3.1.2!

Apache OpenJPA is a Java Persistence API implementation project at The Apache 
Software Foundation.
It can be used as a stand-alone POJO persistence layer or integrated into any 
Java EE compliant container and many other lightweight frameworks, such as 
Tomcat and Spring.

The 3.x releases targetting the JSR-338 Java Persistence 2.2 specification is 
our most current production ready release. It is fully backward compatible 
compatible to our JPA 2.1, 2.0 and 1.0 releases.

The release is available through the official Apache Maven Central repository 
and on our download page
https://openjpa.apache.org/downloads.html

The full change log is available here:
https://openjpa.apache.org/openjpa-3.1.x.html

We welcome your help and feedback. For more information on how to report
problems, and to get involved, visit the project website at

https://openjpa.apache.org/


The Apache OpenJPA Team

Re: Delimited identifiers issue

2020-05-19 Thread Mark Struberg
Hi Xavier!

I'd need to debug through this!

Can you probably share how you created the Entities and the database?
Do you create the DB manually or via OpenJPA?
Is there an explicit name in the @Column annotation or the orm?

In other words: for reproducing the problem we need to know pretty much exactly 
how your situation looks like.

Txs and LieGrue,
strub


> Am 19.05.2020 um 11:55 schrieb Xavier Baqués :
> 
> Hi,
> 
> Adding more context information, my use case is that I am trying to upgrade
> from MySQL 5.7.27 to MySQL 8 but in MySQL 8 there are new reserved words
> which collide with column names I am using on my tables. That is why I need
> to be able to delimit column names.
> 
> I tried to delimit column names in both MySQL 5 and MySQL 8 and got the
> same error message described in my previous email.
> 
> 
> 
> Thanks,
> 
> Xavier Baques
> 
> Software Engineer
> 
> --
> 
>  
> 
> 
> EMAIL: x...@streamsets.com
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Tue, May 19, 2020 at 11:40 AM Xavier Baqués  wrote:
> 
>> Hi,
>> 
>> Sorry to bother you again but I've been trying to find a solution for
>> above issue but still couldn't find a way to make it work.
>> 
>> Any suggestions on what I could do to make it work?
>> 
>> 
>> Thanks,
>> 
>> Xavier Baques
>> 
>> Software Engineer
>> 
>> --
>> 
>>  
>> 
>> 
>> EMAIL: x...@streamsets.com
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> On Wed, May 13, 2020 at 7:08 PM Xavier Baqués  wrote:
>> 
>>> Hi,
>>> 
>>> I am using OpenJPA with Delimited identifiers enabled through the orm.xml
>>> file, I am able to create the database schema and I can see debugging that
>>> table columns are correctly delimited with double quotes in Table object,
>>> however, when I ask EntityManager to create a query it loads the table
>>> metadata into the Table object without columns being delimited, only table
>>> name is delimited. As the columns in table metadata are not delimited, when
>>> the JPQL is parsed an exception is thrown because it cannot find delimited
>>> column names (they are correctly delimited from the corresponding Entity
>>> object) in table metadata (in this case the Table object that gets created
>>> from the table metadata does not have the column names delimited).
>>> 
>>> Is there any way to fix that by changing the configuration and make
>>> Delimited identifiers work correctly?
>>> 
>>> System information:
>>> 
>>> OpenJPA version: 2.4.3
>>> MySQL version: 5.7.27
>>> 
>>> Stack trace of the error:
>>> 
>>> 
>>> org.apache.openjpa.persistence.ArgumentException:
>>> "com.streamsets.apps.pipelinestore.backend.bean.TestInfo.description"
>>> declares column ""DESCRIPTION"", but this column does not exist in table
>>> ""TEST_INFO"".
>>> at
>>> org.apache.openjpa.jdbc.meta.MappingInfo.mergeColumn(MappingInfo.java:692)
>>> at
>>> org.apache.openjpa.jdbc.meta.MappingInfo.createColumns(MappingInfo.java:593)
>>> at
>>> org.apache.openjpa.jdbc.meta.ValueMappingInfo.getColumns(ValueMappingInfo.java:178)
>>> at
>>> org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy.map(StringFieldStrategy.java:84)
>>> at
>>> org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:148)
>>> at
>>> org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:81)
>>> at
>>> org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:498)
>>> at
>>> org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:463)
>>> at
>>> org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:921)
>>> at
>>> org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.java:858)
>>> at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1813)
>>> at
>>> org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:829)
>>> at
>>> org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:784)
>>> at
>>> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:664)
>>> at
>>> org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:418)
>>> at
>>> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:389)
>>> at
>>> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:472)
>>> at
>>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:177)
>>> at
>>> 

Re: PESSMISTIC_READ takes out exclusive lock on Postgres

2020-02-24 Thread Mark Struberg
Hi Pawel!

Would need to dig deeper. Can you possibly please create a JIRA ticket for 
OPENJPA?
So we can better track this!

Thanks!

LieGrue,
strub


> Am 20.02.2020 um 18:22 schrieb Pawel Veselov :
> 
> Hello.
> 
> I've found out that using PESSIMISTIC_READ on an entity with postgres
> uses 'for update' lock, which is actually exclusive.
> 
> I understand JPA specification says that it's permissible to do that,
> but I really need a shared lock for what I'm trying to achieve.
> 
> Is it possible to control somehow? I've had to resolve to using native
> queries, and I'd like to avoid this as much as possible...
> 
> Thank you!
>  Pawel.
> 
> -- 
> With best of best regards
> Pawel S. Veselov



Re: mysql @Column unique

2019-11-18 Thread Mark Struberg
Do you have an example code somewhere?

LieGrue,
strub


> Am 04.11.2019 um 16:46 schrieb Matthew Broadhead 
> :
> 
> i am using  value="buildSchema(ForeignKeys=true)" /> to generate the MySQL tables based 
> on the entities.
> 
> however @Column(unique = true) does not seem to have flaged the field as 
> unique



Re: Detach on cascade turns on phatonmly

2019-07-25 Thread Mark Struberg
Ouch, I see what you mean. 
This is about the _default_ compat option.

I gonna investigate - thanks!


LieGrue,
strub

> Am 22.07.2019 um 15:11 schrieb Pawel Veselov :
> 
> Hello Mark.
> 
> I'm afraid you misunderstand the problem. Have you looked at the changes I
> made?
> There is no shared use for the entities between threads. We don't modify
> the compat options directly, OpenJPA does that.
> The problem is in OpenJPA changing compatibility variables (for cascading
> operations), and that those variables are near global,
> which causes other threads to behave differently and unexpectedly. Plus,
> restoring the state has a race condition, causing
> the wrong compat settings to get stuck.
> 
> -- Pawel.
> 
> 
> On Thu, Jul 18, 2019 at 9:30 AM Mark Struberg 
> wrote:
> 
>> Hi Pawel!
>> 
>> I fear you are hitting a rather lightly used path in OpenJPA.
>> Although I wonder why you can hit a race condition?
>> An EntityManager - and thus it's entities - are intended to be accessed
>> only from a single thread at a time.
>> Storing entities in a shared cache or whatever concurrently used object is
>> always a bad idea.
>> 
>> Can you probably shade a light on why you need those compat modes in the
>> first place?
>> Usually one doesn't need it if the app is properly designed.
>> Are you probably working on an ancient legacy code. And in that case, what
>> patterns do they use to work with JPA?
>> 
>> txs and LieGrue,
>> strub
>> 
>> 
>>> Am 12.07.2019 um 15:37 schrieb Pawel Veselov :
>>> 
>>> Hello.
>>> 
>>> https://issues.apache.org/jira/browse/OPENJPA-2792
>>> 
>>> Has took me a while to track down, and leaves quite unpleasant surprises,
>>> as your entities become detached without warning, which leads to phantom
>>> NPEs at places you never expect to happen.
>>> 
>>> --
>>> With best of best regards
>>> Pawel S. Veselov
>> 
>> 
> 
> -- 
> With best of best regards
> Pawel S. Veselov



Re: Detach on cascade turns on phatonmly

2019-07-18 Thread Mark Struberg
Hi Pawel!

I fear you are hitting a rather lightly used path in OpenJPA.
Although I wonder why you can hit a race condition?
An EntityManager - and thus it's entities - are intended to be accessed only 
from a single thread at a time.
Storing entities in a shared cache or whatever concurrently used object is 
always a bad idea.

Can you probably shade a light on why you need those compat modes in the first 
place?
Usually one doesn't need it if the app is properly designed.
Are you probably working on an ancient legacy code. And in that case, what 
patterns do they use to work with JPA?

txs and LieGrue,
strub


> Am 12.07.2019 um 15:37 schrieb Pawel Veselov :
> 
> Hello.
> 
> https://issues.apache.org/jira/browse/OPENJPA-2792
> 
> Has took me a while to track down, and leaves quite unpleasant surprises,
> as your entities become detached without warning, which leads to phantom
> NPEs at places you never expect to happen.
> 
> -- 
> With best of best regards
> Pawel S. Veselov



Re: using different datasource during junit tests

2019-02-13 Thread Mark Struberg
You can provide a map to 
javax.persistence.Persistence#createEntityManagerFactory(String pu, Map 
properties);
That way you can define the Driver, jdbc user + pwc, url, etc

That way you don't need anything in your persistence.xml.

If you use CDI you can create a producer for it or use the one from DeltaSpike.
Or you use TomEE where you can do the same. You can pass a property map to 
DeltaSpike CdiCtrl boot(Map):
https://github.com/apache/deltaspike/blob/master/deltaspike/cdictrl/api/src/main/java/org/apache/deltaspike/cdise/api/CdiContainer.java#L58

LieGrue,
strub

> Am 13.02.2019 um 17:10 schrieb Francesco Chicchiriccò :
> 
> On 13/02/19 15:04, Matthew Broadhead wrote:
>> i am trying to test some business logic that depends heavily on the results 
>> of calls to entitymanager.  i would like to keep the persistence.xml exactly 
>> as it is in the main project but basically load in a different database 
>> underneath.  is there a way to initialise the entitymanager and point it to 
>> a development database for the duration of the tests?
> 
> Hi Matthew,
> I normally do as you require above, but with some Spring ORM support, not 
> sure it fits with your scenario; if so, I can point you to some working 
> samples.
> 
> Regards.
> 
> -- 
> Francesco Chicchiriccò
> 
> Tirasa - Open Source Excellence
> http://www.tirasa.net/
> 
> Member at The Apache Software Foundation
> Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
> http://home.apache.org/~ilgrosso/
> 



Re: @Converter(autoApply=true)

2019-02-07 Thread Mark Struberg
 Hi Rob!
Thanks for your example!
I'll gonna check your sample and try to get it working.It's likely not working 
in 3.0.0 right now, but we try to fix it for 3.0.1.
What you can do in the meantime is to use a ValueHandler instead. 
This is the OpenJPA specific version which predates the JPA @Converter logic.
rsandtner/openjpa-converter

| 
| 
| 
|  |  |

 |

 |
| 
|  | 
rsandtner/openjpa-converter

Contribute to rsandtner/openjpa-converter development by creating an account on 
GitHub.
 |

 |

 |




LieGrue,strub

On Wednesday, 6 February 2019, 22:05:48 CET, Robert Scala 
 wrote:  
 
 Hello,

I'm trying OpenJPA 3.0.0 so I can use the AttributeConverter annotation.

But I'm having problems.  My converter is simple:

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

@Converter(autoApply = true)
public class StringInternConverter implements AttributeConverter
{
     @Override
     public String convertToDatabaseColumn(String attribute)
     {
     return attribute;
     }

     @Override
     public String convertToEntityAttribute(String dbData)
     {
     return dbData != null ? dbData.intern(): null;
     }
}

The problem is that I can't get JPA to see this converter.  When I add 
it to persistence.xml like this:

     
com.be.db.jpa.StringInternConverter

The enhancer complains that it StringInternConverter "does not have 
persistence metadata".

Is there a trick to get this to work?

Thanks,

Rob


-- 
Rob Scala
Buyers Edge, Inc.
351 North Frontage Road, Suite A210
New London, CT 06320
Phone: (860) 865-2127
  

Re: OpenJPA issues black hole

2019-01-20 Thread Mark Struberg
Not yet but it‘s on my list!
And please keep reminding me! Tryind to do it this week!

LieGrue,
Dtrub

> Am 20.01.2019 um 23:43 schrieb Pawel Veselov :
> 
> Mark,
> 
> Entschuldigung for the nagging, any luck? :)
> 
>> On Tue, Jan 1, 2019 at 11:08 PM Mark Struberg  
>> wrote:
>> 
>> Sorry Pavel, right now sitting over a nasty glitch in a few of our unit 
>> tests.After that I'll run through your tickets.
>> LieGrue,strub
>> 
>>On Monday, 31 December 2018, 05:08:06 CET, Pawel Veselov 
>>  wrote:
>> 
>> Hello.
>> 
>> I've been using OpenJPA for a while, and I'd like to understand what's
>> going on with the bug fixing process.
>> 
>> Over the course of time, I have filed a few bugs. I'm only going to
>> concentrate on ones that we had to fix ourselves:
>> OPENJPA-2733
>> OPENJPA-2735
>> OPENJPA-2736
>> OPENJPA-2749
>> 
>> Explanation of what the problem is, and the attempt to patch is
>> provided for each one of those. There was absolutely no activity from
>> the development team on any of those.
>> 
>> There hasn't been any release activity for a while as well. Now I see
>> that 2.4.3 and 3.0.0 have we been released. That's great, but do they
>> address any of the problems we have? It's not that easy to find out,
>> and considering the bug activity, I would expect they aren't.
>> 
>> My question is then simply - what do I need to do to be heard? AFAIK I
>> do a good amount of pre-work for determining the test cases, the root
>> causes, and fixes suggestions, for the development team to be able to
>> include this. Obviously, I don't understand OpenJPA code enough to
>> know whether my fixes are correct, but that's why I leave it for the
>> development team to close.



[DISCUSS] end support for OpenJPA-1.x?

2019-01-07 Thread Mark Struberg
hi folks!

I think the times of the 1.x rage of OpenJPA is over.
This is our JPA-1.0 branch (JavaEE5).
Wdyt about declaring it EOL and closing all the tickets for it?

Of course OpenJPA-2.x and 3.x will continue to be active!

LieGrue,
strub


Re: deleting openjpa_sequence_table

2019-01-05 Thread Mark Struberg
Hi Matthew!

As Craig already explained they contain the hightest value for a specified 
index.
Of course only if no Database Sequence got used!
The reason to use this over a Sequence is to have a database independent 
counter which is fully portable.

There are also multiple 'modes' for the sequence to operate!
I personally prefer the counter by table.

In your persistence.xml you might probably have something like the following in 
your  section:



openjpa.Sequence determines the strategy to use plus the details. 'class-table' 
will create 1 row per @Entity basically.

You can read more over here:
https://openjpa.apache.org/builds/3.0.0/apache-openjpa/docs/ref_guide_sequence.html


So in hindsight dealing with the openjpa_sequence values might be your least 
problematic issue.
The more problematic one might be that you have to re-assign new primary keys 
to your migrated data.

Consider you have an @Entity Customer. Then both or your databases to merge 
might have a Customer with the id=1. And 2 customers with id=2, etc.
That means merging them together will create a unique key violation. 

One strategy is to leave one db as is and update the other one.
If you e.g. have 18572 customers in database_A. Then you could update all your 
customers in database_B to be 1+id. Means your customer with id=1 in 
database_B will get id=11, etc. And of course you will have to update all 
the 1:n referencing tables as well. So e.g. update all Address entries to have 
a customerid=customerid+10; 
You might need to drop/disable all foreign-key indexes before you start doing 
this update and then activate them again after all is done. 
And of course this can only be done while there is no moving target. That means 
you have to stop operation on your db. If this is not possible then you might 
want to do this with 'filtered tx-logs'. But that is WAY more effort...

After that you can merge both without a conflict.

Do others have a better idea?

LieGrue,
strub



> Am 05.01.2019 um 01:04 schrieb Craig Russell :
> 
> It might be best to inspect the tables and merge them when you merge the 
> databases. IIRC they hold the highest keys that have been used and simply 
> dropping them might introduce errors.
> 
> Craig
> 
>> On Jan 4, 2019, at 5:40 AM, Matthew Broadhead 
>>  wrote:
>> 
>> i am about to merge a few databases.  each database has an 
>> openjpa_sequence_table.  do i just drop these tables?
> 
> Craig L Russell
> c...@apache.org
> 



Re: openjpa indexes

2019-01-02 Thread Mark Struberg
 The generator happens in the MappingTool. This is the top-level.Probably the 
best guess is to set a breakpoint in  DBDictionary#getCreateIndexSQLThe 
DBDictionary (and it's respecive subclasses) is where all the adopting to 
different databases happens.
LieGrue,strub

On Tuesday, 18 December 2018, 03:53:51 CET, Maxim Solodovnik 
 wrote:  
 
 Unfortunately I was unable to find where this magic happens :(
can someone from devs can point me to the right direction?

On Sat, 15 Dec 2018 at 16:58, Matthew Broadhead
 wrote:

> i am using mysql
>
> On 15/12/2018 09:35, Maxim Solodovnik wrote:
> > Indicies seems to be auto-created on
> > @Id, @PrimaryKeyJoinColumn and @JoinColumn
> >
> > just have tested with MySql DB Index seems not being created
> > will try to debug
> >
> >
> > On Thu, 13 Dec 2018 at 23:33, Matthew Broadhead
> >  wrote:
> >
> >> i saw a similar example but was hoping the index could be automatically
> >> created.  some indexes are automatically created but seeingly not
> others.
> >> i tried the annotations as in the example and the index is never
> >> created.  here is what i have added to my class
> >> @Entity
> >> @Table(name = "billentry", indexes = {
> >>          @Index(name = "I_BLLNTRY_SECTION", columnList =
> >> "BILLSECTION_ID", unique = false),
> >>          @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY", columnList =
> >> "btentryid", unique = false) })
> >> public class BillEntry implements Serializable {
> >>      private static final long serialVersionUID = 1L;
> >>
> >>      @Id
> >>      @GeneratedValue(strategy = GenerationType.IDENTITY)
> >>      private Long id;
> >>
> >>      @Version
> >>      private Long version;
> >>
> >>      @ManyToOne
> >>      private BillSection billSection;
> >>
> >>      @ManyToOne
> >>      @Column(name = "btentryid")
> >>      private BillTemplateEntry billTemplateEntry;
> >>
> >> On 12/12/2018 02:34, Maxim Solodovnik wrote:
> >>> This might help for the latest OpenJpa (it should have partial 2.1
> >>> compatibility)
> >>> https://stackoverflow.com/a/22658951/3571661
> >>>
> >>> On Wed, 12 Dec 2018 at 01:17, Matthew Broadhead
> >>>  wrote:
> >>>
>  recently had an application running slowly and had to manually add an
>  index.  but openjpa seemed to create all the other indexes
> >> automatically.
>  my structure was like
>  Bill
>  has a collection of
>  BillMoney
>  has a collection of
>  BillSection
>  has a collection of
>  BillEntry
> 
>  BillMoney was automatically created with index I_BLLMONY_BILL which
>  related to the Bill id
>  BillSection was automatically created with index I_BLLSCTN_BILLMONEY
>  which related to the BillMoney section
>  But BillEntry did not have an index.
> 
>  BillEntry was a pre existing table so could that have something to do
>  with it?  is there any way to force indexes to be created?
> 
> >>
>
>

-- 
WBR
Maxim aka solomax
  

Re: OpenJPA issues black hole

2019-01-01 Thread Mark Struberg
 Sorry Pavel, right now sitting over a nasty glitch in a few of our unit 
tests.After that I'll run through your tickets.
LieGrue,strub

On Monday, 31 December 2018, 05:08:06 CET, Pawel Veselov 
 wrote:  
 
 Hello.

I've been using OpenJPA for a while, and I'd like to understand what's
going on with the bug fixing process.

Over the course of time, I have filed a few bugs. I'm only going to
concentrate on ones that we had to fix ourselves:
OPENJPA-2733
OPENJPA-2735
OPENJPA-2736
OPENJPA-2749

Explanation of what the problem is, and the attempt to patch is
provided for each one of those. There was absolutely no activity from
the development team on any of those.

There hasn't been any release activity for a while as well. Now I see
that 2.4.3 and 3.0.0 have we been released. That's great, but do they
address any of the problems we have? It's not that easy to find out,
and considering the bug activity, I would expect they aren't.

My question is then simply - what do I need to do to be heard? AFAIK I
do a good amount of pre-work for determining the test cases, the root
causes, and fixes suggestions, for the development team to be able to
include this. Obviously, I don't understand OpenJPA code enough to
know whether my fixes are correct, but that's why I leave it for the
development team to close.

Thank you,
  Pawel.
  

Re: OpenJPA2.3.0 - Fail to find object with multiple collection + reverse mapping of polymorphic objects + EAGER-FETCHING

2018-11-03 Thread Mark Struberg
 do you mind to share the entities?
LieGrue,strub

On Friday, 2 November 2018, 12:31:20 CET, Stephane Passignat 
 wrote:  
 
 Hello,

When a class (Product) have 2 collections (I only checked with reversed 
mapping) of concrete objects (one of MecanicalFeature and one of 
ElectricalFeature) inheriting from a common class (Feature), finding an 
existing Product fails (return null).

Here is a class diagram : 
http://www.plantuml.com/plantuml/png/SoWkIImgAStDuKhEIImkLWWeoayfJIw1yjnI4qjAYrAXFD_KvCIypEJ475HXrvpKv98YP74kT9KAkherTd3J81fmIaET01IqKr3IKbB0CCnAGIaN9bQiXA4UOZoQXbIm85I7GsfU2j3B

Here is the ER diagram
http://www.plantuml.com/plantuml/png/RSvFIyCm60Rm-_ifNkTb0SVk4iF6ia9FokpE8pNlR31fI_v0Y_ZTLLhR2iijvFSyUNOXAX-Jit2dwMfgmgXAI-kEuPjL8M27dEEwUBZFiltFOIZ4H5jldFBzvOFwtm0l1K-Yuzia-BQSsRNnPDxhYPa5Cm8gemaTnQhHORY4I9wQsBSK08OzBwTdUJuK33y1__sRImPV8ygE--9yEjv6Y39_FG0kv_pLNeQMCO-RZS3nvN4rawTShc17jKxEVWC0


The entityManager.find generates the following SQL (I replaced useless columns 
by *) :
SELECT t0.*,
      t3.*
FROM Product t0
      LEFT OUTER JOIN Feature t3 ON t0.id = t3.PRODUCT_ID
WHERE (t3.disc IS NULL OR t3.disc IN ('Mecanical'))
  AND t0.id = 0
ORDER BY t3.PRODUCT_ID ASC

The eager fetching on those collections consider only one collection or only 
one type of concrete class. A solution would be to have, in the IN clause the 
list of all possible subtypes of all collections mapped on the target table 
(‘Mecanical’, ‘Electrical’).


Regards,


Provenance : Courrier pour 
Windows 10
  

Re: Primary key string ids are stripped

2018-10-27 Thread Mark Struberg
 'not able to find it right after'
+1 to what Matthew said. We need a bit more info.
Say you have the following code:
Customer c = new Customer();c.setName("Bla");em.persist(c);Long id = c.getId();
is this about what you did?
Plus: what enhancement strategy do you use? And what @GenerationType if any on 
the @Id?

There are now so many different scenarios out there that it might be better if 
you could provide parts of your code in a sample.
LieGrue,strub

On Friday, 26 October 2018, 09:55:37 CEST, Matthew Broadhead 
 wrote:  
 
 can you give a small example?  do you mean when the field annotated @Id 
is a String then find returns null?

On 25/10/2018 02:34, Pawel Veselov wrote:
> Hello.
>
> I just found out, the hard way, that OpenJPA strips the string entity
> IDs when doing find().
> It doesn't strip those values when saving entities with corresponding
> primary keys.
> Is there a particular reason for this? It sounds weird to create an
> entity with primary key "0\t", but then not be able to find it right
> after
>
> Thank you,
>    Pawel.

  

[ANNOUNCE] master branch in GIT

2018-10-15 Thread Mark Struberg
Good morning!

As previously discussed: I now created a master branch which will contain the 
ongoing work in Apache OpenJPA 3.x.
The 'trunk' git branch is now defunct and only kept for historical reasons. 
I'll add a small note in the README.

Please check out the master branch for futher work!

Oh and a reminder again:
To get the most recent OpenJPA code just use

$> git clone https://gitbox.apache.org/repos/asf/openjpa.git.


LieGrue,
strub



[ANNOUNCE] The Apache OpenJPA source code repository has been switched to GIT

2018-10-12 Thread Mark Struberg
Good afternoon!
Our main source repo is now hosted via GIT
> Chris Thistlethwaite added a comment - Just now > SVN marked read only, 
> git.apache.org updated, migrated to gitbox.
>
> Go through any setup on https://gitbox.apache.org/setup/
>
> Your remotes are now:
> 
> https://gitbox.apache.org/repos/asf/openjpa.git
> or
> https://github.com/apache/openjpa.git 

LieGrue and have fun,strub


Re: clone object

2018-07-27 Thread Mark Struberg
In practice this is likelymuch more complicated. Where are the boundaries?
If you have a Person which has a relation to a Company, then I assume you do 
not want to also clone the whole Company, right? ;)
But of course, the n Address rows probably should get cloned?

Do you see what I mean? This is imo all depending on your exact intention and 
the tables in question.

LieGrue,
strub


> Am 27.07.2018 um 16:08 schrieb Matthew Broadhead 
> :
> 
> i have a complicated object with a large number of children, each child 
> possibly having their own large number of children.  what would be great in 
> OpenJPA is if you could, say, detach an object and run a command which would 
> null all @Id and @Version fields in the detached Object and all its 
> descendants.  i suppose it has to be done manually though...
> 
> On 27/07/18 15:52, Albert Lee wrote:
>> If the java object implements Serializable or Clonable, you can
>> writeObject/readObject to clone to a new entity.  The new object will be
>> detached and you can reset the id and version as you wish.
>> 
>> 
>> On Fri, Jul 27, 2018 at 8:39 AM, Matthew Broadhead <
>> matthew.broadh...@nbmlaw.co.uk.invalid> wrote:
>> 
>>> i don't think it would clear the id and version fields?  do you mean using
>>> SerializationUtils clone?
>>> https://commons.apache.org/proper/commons-lang/apidocs/org/
>>> apache/commons/lang3/SerializationUtils.html
>>> 
>>> 
>>> On 27/07/18 15:09, Albert Lee wrote:
>>> 
 If the entity is serializable have you try writing it out and read it back
 to a new object?
 
 On Fri, Jul 27, 2018, 6:05 AM Matthew Broadhead
  wrote:
 
 is there a way to deep clone a JPA object automatically?  i.e. to copy
> all the parameters and children but clear the id and version fields?
> 
> i saw that it is possible to do em.detach(object); and then reset the id
> and version but by the time i have done that i may as well have written
> a full copy function.
> 
> 
>> 
> 



Re: native query

2017-09-08 Thread Mark Struberg
puh, cannot answer out of my head, but will write a unit test to dig.
Might help if you could provide a sample which also runs against EclipseLink 
and Hibernate.
After all this is also about interoperability.

LieGrue,
strub

> Am 07.09.2017 um 18:56 schrieb Matthew Broadhead 
> :
> 
> hi i tried this but it seems to just hang.  is this not supported?
> 
> private void updateAutoIncrement(int currentId) {
>   Query q = em.createNativeQuery("ALTER TABLE test auto_increment = ?;");
>   q.setParameter(1, (currentId + 2));
>   q.executeUpdate();
> }



Re: JPA criteria

2017-07-23 Thread Mark Struberg
Hi!

You mind to send a patch?

txs and LieGrue,
strub


> Am 21.07.2017 um 23:50 schrieb Matthew Broadhead 
> :
> 
> Hi Rob,
> 
> yes thanks in the end i did this
> Join detail = entity.join(EntityZ_.details);
> 
> the documentation page linked in my first email 
> (https://openjpa.apache.org/builds/2.4.2/apache-openjpa/docs/jpa_overview_criteria.html)
>  is for 2.4.2 which is what i am using bundled in TomEE 7.0.3.   the examples 
> on the page should be updated to reflect what we are saying here?
> 
> Matt
> 
> On 21/07/2017 19:32, Rob Scala wrote:
>> Matthew,
>> 
>> I haven't done this yet, but the documentation states that join returns a 
>> Join object, not a Root.  I think in your case, it returns a 
>> Join.
>> 
>> Where does the documentation need to be updated?
>> 
>> Rob
>> 
>> 
>> On 07/21/2017 12:50 PM, Matthew Broadhead wrote:
>>> Thanks Rob, this works:
>>> criteriaQuery.where(criteriaBuilder.equal(entity.get(EntityZ_.id), 
>>> entityId));
>>>  maybe the documentation needs updating?
>>> 
>>> 
>>> 
>>> On 21/07/2017 12:49, Rob Scala wrote:
 
 Matthew,
 
 On your second point, expression methods (equal, gt, etc) belong to the 
 CriteriaBuilder, not to the expressions.
 
 cb.equal(exp1, exp2)
 
 http://docs.oracle.com/javaee/7/api/javax/persistence/criteria/CriteriaBuilder.html
  
 
 Rob
 
 
 On 07/21/2017 05:03 AM, Matthew Broadhead wrote:
> Following the example on page 
> https://openjpa.apache.org/builds/2.4.2/apache-openjpa/docs/jpa_overview_criteria.html
> 
> CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
> CriteriaQuery criteriaQuery = 
> criteriaBuilder.createQuery(EntityZ.class);
> Root entity = criteriaQuery.from(EntityZ.class);
> Root detail = entity.join(entity.get(EntityZ_.details));
> 
> results in
> 
> Type mismatch: cannot convert from Expression to 
> SingularAttribute
> 
> also is there a typo?
> 
> qdef.where(customer.get(Customer_.name).equal("John 
> Doe").and(order.get(Order_.status).equal(OrderStatus.DELIVERED).not())); 
> 
> there is no such function as equal?  should it be equals? also in my case:
> 
> criteriaQuery.where(entity.get(EntityZ_.id).equals(entityId));
> 
> results in:
> 
> The method where(Expression) in the type CriteriaQuery 
> is not applicable for the arguments (boolean)
 
 -- 
 *Rob Scala*
 Director of Information Technology
 Buyers Edge, Inc
 351 N. Frontage Road, Suite A210
 New London, CT 06320
 Phone - 860-865-2127
 Fax - 860-701-0576
>>> 
> 



Re: Problem with EntityExistsException

2017-04-24 Thread Mark Struberg
Hi Malte!

puh, that's a pretty tricky puzzler.

You flush and detach. At this point the 'data' instance has the information 
that it got inserted. 
Since the entity got detached it also has no further information that the 
transaction got rolled back.
So technically I can understand what happens.

I also do not think this is ruled out by the spec. Otoh it's surely also not 
defined that it should work.
So my guess is that you are hitting a rather unspecified area of JPA.

What if you just move the detach to a finally block?
Would that probably solve your problem?

LieGrue,
strub
 
> Am 24.04.2017 um 17:55 schrieb Malte :
> 
> Hello all!
> 
> In a special situation, I'll get a wrong EntityExistsException.
> 
> I've extract the problem to a simple project (attached).
> 
> I do this:
>try {
>  entManager.persist(data);
>  entManager.flush();
>  entManager.detach(data);
> 
>  doOtherDBCallsWithError();
> 
>  entManager.getTransaction().commit();
>} catch (Exception e) {
>   entManager.getTransaction().rollback();
> 
>   entManager.getTransaction().begin();
>   entManager.persist(data);
>   entManager.getTransaction().commit();
>} 
> 
> If doOtherDBCallsWithError throws an Exception, it is not possible to persist 
> the object in the catch-block. The second persists throws 
> "org.apache.openjpa.persistence.EntityExistsException: Attempt to persist 
> detached object "de.test.model.Test-1".  If this is a new instance, make sure 
> any version and/or auto-generated primary key fields are null/default when 
> persisting." If I use merge instead, the object will also not persist. If I 
> remove the detach, everything works.
> 
> Is this a bug or is the call order persist-flush-detach-commit against the 
> specification?
> 
> Best regards,
> Malte
> 



Re: JPA 2.1

2017-02-14 Thread Mark Struberg
Hi Charlie!

trunk is targetting JPA-2.1 but we still have quite a bit to go until we are 
spec compliant.

LieGrue,
strub

> Am 10.02.2017 um 15:02 schrieb Charlie Mordant :
> 
> Hi best ORM mapper implementers!
> 
> I caught some mailing list mails which spoke about 2.1 implementation on
> the way. What's the current status?
> Spring 5 forces 2.1 compliance as a prerequisite so it should be nice to
> have a 2.1 support (also, I really dislike Hibernate as an orm, OpenJPA is
> far more bullet proof IMHO).
> 
> Best regards,
> 
> -- 
> Charlie Mordant
> 
> Full OSGI/EE stack made with Karaf:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent



Re: java.lang.NoSuchMethodError: ....AggregationEntity.pcGetManagedFieldCount()

2017-02-08 Thread Mark Struberg
Maybe you have an import of a class which doesn't exist?

Did you try to debug into and do a Class.forName in the debugger?
It also might be something missing by the annotations.

Just a first guess. 

LIeGrue,
strub


> Am 03.02.2017 um 20:17 schrieb Pachler, Uwe :
> 
> Hi, 
> 
> I'm facing a nasty issue with my freshly refactored entity class hierarchy 
> (things did work before):
> 
> openjpa.MetaData - The class "com.mycompany.FamilyAggregationEntity" listed 
> in the openjpa.MetaDataFactory configuration property could not be loaded by 
> org.apache.openejb.arquillian.openejb.SWClassLoader@5b408dc3; ignoring.
> 2091  corbox_appgateway  TRACE  [main] openjpa.MetaData - 
> java.lang.NoSuchMethodError: 
> de.datagroup.corbox.appgateway.bizimpl.db.entities.AggregationEntity.pcGetManagedFieldCount()Ijava.lang.NoSuchMethodError:
>  
> de.datagroup.corbox.appgateway.bizimpl.db.entities.AggregationEntity.pcGetManagedFieldCount()I
>   at 
> de.datagroup.corbox.appgateway.bizimpl.db.entities.ManagedCustomersFamilyAggregationEntity.(ManagedCustomersFamilyAggregationEntity.java)
>   at java.lang.Class.forName0(Native Method)
>   at java.lang.Class.forName(Class.java:348)
>   at 
> org.apache.openjpa.meta.MetaDataRepository.classForName(MetaDataRepository.java:1559)
>   at 
> org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1535)
>   at 
> org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1513)
>   at 
> org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:279)
>   at 
> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:235)
>   at 
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:211)
>   at 
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154)
>   at 
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
>   at 
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
>   at 
> org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:178)
>   at 
> org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:130)
>   at 
> org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:145)
>   at 
> org.apache.openejb.persistence.JtaEntityManager.typedProxyIfNoTx(JtaEntityManager.java:382)
>   at 
> org.apache.openejb.persistence.JtaEntityManager.createNamedQuery(JtaEntityManager.java:430)
> 
> The entity class in question does appear in the list printed by OpenJPA  as 
> 'persistend type name' before the exception happens:
> 
> 2043  corbox_appgateway  TRACE  [main] openjpa.MetaData - 
> parsePersistentTypeNames() found [... com.mycompany.FamilyAggregationEntity 
> ...]
> 
> I have a hierarchy of entity classes, like this:
> 
> @Entity
> @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
> public abstract class AggregationEntity implements Aggregation, Serializable {
> ..
> }
> 
> @Entity
> @Table(name="...")
> @NamedQueries({
> ...
> })
> public class FamilyAggregationEntity extends AggregationEntity {
> ..
> }
> 
> There are other entity subclasses of AggregationEntity, and these were 
> present and working before adding FamilyAggregationEntity..
> 
> I also tried @MappedSuperclass on AggregationEntity instead of 
> @Entity/@Inheritance (which is probably better JPA-standards-wise), but that 
> didn't help either...
> 
> Any ideas greatly appreciated.
> 
> Thanks,
> 
> Uwe
> 



Re: Request for gradle equivalent to ant script for Enahncer

2017-01-18 Thread Mark Struberg
Roberto, do you mind to probably contribute this to the OpenJPA project?
Could make a nice addition alongside the openjpa-maven-plugin!

txs and LieGrue,
strub

> Am 18.01.2017 um 16:13 schrieb Roberto Cortez :
> 
> Hi Vardhaman,
> Sorry for this late response.
> I've been working on a OpenJPA Gradle plugin, and I was only able to release 
> it in the last couple of days. Here is the link for 
> it:https://github.com/radcortez/openjpa-gradle-plugin
> 
> Please, let me know how it works out for you.
> Cheers,Roberto 
> 
>On Monday, January 9, 2017 4:25 PM, vardhaman narasagoudar 
>  wrote:
> 
> 
> Dear Team,
> 
> Good day,
> 
> Does any one has compiled JPA pojo using Enhancer on gradle for tomcat, If
> yes, can they share the sample or equivalent to ant which is present in the
> site,
> 
> Looking forward for your valuable suggestion.
> 
> -- 
> Thanks & Regards
> Vardhaman B.N
> 9945840928
> 
> 



[ANNOUNCE] Welcome Christian Schneider as new OpenJPA committer

2016-12-05 Thread Mark Struberg
Good evening!

The OpenJPA community is happy to announce that Christan Schneider will join 
the project as committer.
Christian is an OSGi Expert and especially intersted to smoothen the experience 
of running OpenJPA in Camel, Karaf, etc.

Welcome on board, Christian!

your OpenJPA team

Re: fetching associations

2016-11-14 Thread Mark Struberg
Hi Matthew!

EclipseLink seems to open a new connection for lazy loading by using a new 
temporary EntityManager and Transaction. And no XA transaction afaik. 
Of course this is by far not a portable behaviour as neither Hibernate nor 
OpenJPA support this. I also have no clue how it behaves in case of an 
OptimisticLockException. I mean the lazy loading can literally happen a few 
minutes later...

Whether to go back to EclipseLink is a question on how your whole application 
looks like. You did use a non-portable feature and of course it is now a bit 
harder to switch providers. But it's not impossible. 
The usual solution is to keep the EntityManager open for the whole request. 
How big is your app and how old is the codebase? 
Do you use XA or resource-local?
Does it use many EJBs or do you already mainly use CDI? 

In case of the later you can use a @RequestScoped EntityManager + DeltaSpike 
@Transactional for example.
https://deltaspike.apache.org/documentation/jpa.html

Sample code
With XA (JTA):
https://github.com/struberg/lightweightEE/blob/jtacdi11/backend/src/main/java/de/jaxenter/eesummit/caroline/backend/tools/EntityManagerProducer.java#L35
https://github.com/struberg/lightweightEE/blob/jtacdi11/backend/src/main/java/de/jaxenter/eesummit/caroline/backend/impl/EmployeeServiceImpl.java
https://github.com/struberg/lightweightEE/blob/jtacdi11/backend-api/src/main/resources/META-INF/persistence.xml#L9
https://github.com/struberg/lightweightEE/blob/jtacdi11/gui/src/main/tomee/conf/tomee.xml

With ResourceLocal:
https://github.com/struberg/lightweightEE/blob/cdi11/backend/src/main/java/de/jaxenter/eesummit/caroline/backend/tools/EntityManagerProducer.java
https://github.com/struberg/lightweightEE/blob/cdi11/backend/src/main/java/de/jaxenter/eesummit/caroline/backend/impl/EmployeeServiceImpl.java
https://github.com/struberg/lightweightEE/blob/cdi11/backend/src/main/resources/persistence-CaroLine.properties
https://github.com/struberg/lightweightEE/blob/cdi11/backend-api/src/main/resources/META-INF/persistence.xml


I also wrote a few blog posts which might help you understand this topic, e.g.
https://struberg.wordpress.com/2015/04/21/transaction-and-exception-handling-in-ejbs-and-javaee7-transactional/

Of course the entitymanager-per-request pattern also has a few limitations, 
e.g. if cannot lazy load data in subsequent responses (data has to be rendered 
during the initial request).
But it's rather easy to prevent such a scenario. Usually you will only use 
Entities in CRUD dialogues anyway.
I would e.g. _not_ use the entities in DataTables on a search dialogue. In that 
case I'd rather use a dedicated list item via SELECT NEW. This is much faster, 
has way less memory overhead and also will prevent you from a lot optimistic 
locking pain.

Feel free to ask more questions, this is a rather complex and often not well 
enough understood topic.

LieGrue,
strub




> Am 14.11.2016 um 20:12 schrieb Matthew Broadhead 
> <matthew.broadh...@nbmlaw.co.uk>:
> 
> so if the managedbean is not an ejb anymore and therefore the transaction is 
> closed how does it work for eclipselink?  do they use some magic?  are there 
> any plans for implementing this "feature" in the future?  after spending a 
> few months migrating to myfaces and openjpa on the suggestion of romain i now 
> find that openjpa cannot lazy load entities from jsf which is fairly 
> disappointing to say the least.  is my best route to go back to eclipselink?
> 
> On 09/11/2016 17:40, Mark Struberg wrote:
>> Oki all clear. The internal EntityManager will get closed when you leave the 
>> outer @Stateless method.
>> @Stateless EJBSs really are nothing else than beans with an interceptor 
>> which opens and commits the transaction and EntityManager on the outermost 
>> EJB level.
>> 
>> Since the @ManagedBean is not an EJB anymore you don't have any transaction 
>> nor EntityManager open anymore in your render_response phase in JSF. Which 
>> means that OpenJPA cannot provide lazyloading for you.
>> 
>> I personally prefer to use the entitymanager-per-request patter and using 
>> CDI with a @RequestScoped EntityManager. But that might be a bigger change 
>> in architecture for you.
>> Other options are:
>> 
>> * touching the required bits in your DAO
>> 
>> * using eager fetching
>> * using a fetch-plan
>> * using DTOs
>> 
>> LieGrue,
>> strub
>> 
>> 
>> 
>> 
>> 
>>> On Wednesday, 9 November 2016, 17:31, Matthew Broadhead 
>>> <matthew.broadh...@nbmlaw.co.uk> wrote:
>>>> sorry for the delay in replying i was very busy
>>> as a simple example there is a generic Dao class to return the results
>>> of a namedquery
>>> @Stateless
>>> public clas

Re: fetching associations

2016-11-09 Thread Mark Struberg
Oki all clear. The internal EntityManager will get closed when you leave the 
outer @Stateless method.
@Stateless EJBSs really are nothing else than beans with an interceptor which 
opens and commits the transaction and EntityManager on the outermost EJB level.

Since the @ManagedBean is not an EJB anymore you don't have any transaction nor 
EntityManager open anymore in your render_response phase in JSF. Which means 
that OpenJPA cannot provide lazyloading for you.

I personally prefer to use the entitymanager-per-request patter and using CDI 
with a @RequestScoped EntityManager. But that might be a bigger change in 
architecture for you.
Other options are: 

* touching the required bits in your DAO

* using eager fetching
* using a fetch-plan
* using DTOs

LieGrue,
strub





> On Wednesday, 9 November 2016, 17:31, Matthew Broadhead 
> <matthew.broadh...@nbmlaw.co.uk> wrote:
> > sorry for the delay in replying i was very busy
> 
> as a simple example there is a generic Dao class to return the results 
> of a namedquery
> @Stateless
> public class DAO {
>  @PersistenceContext(unitName = "widgetDataSource")
>  private EntityManager em;
>  
>  @SuppressWarnings("unchecked")
>  public  List namedFind(Class clazz, String 
> query) {
>  return em.createNamedQuery(query, clazz).getResultList();
>  }
>  
> }
> call the namedFind from another stateless
> @Stateless
> public class WidgetDAO {
>  @EJB
>  private DAO dao;
>  ...
>  public List findAll() {
>  return dao.namedFind(Widget.class, "Widget.findAll");
>  }
>  
> }
> this is loaded into a managedbean
> @ManagedBean
> @ViewScoped
> public class WidgetBean {
>  @EJB
>  private WidgetDAO widgetDao;
>  private List widgetList;
>  public void onload(){
>  setWigdetList(widgetDao.fildAll());
>  }
>  ...setter getter of widgetList
> }
> which is supposed to display in jsf
> 
> http://www.w3.org/1999/xhtml;
>  xmlns:h="http://java.sun.com/jsf/html;
>  xmlns:ui="http://java.sun.com/jsf/facelets;
>  xmlns:f="http://java.sun.com/jsf/core;
>  template="/WEB-INF/include/layout.xhtml">
>  ...
>   value="#{widgetBean.widgetList}">
>   value="#{widget.subWidgets}">
>  ...where are the sub widgets?
>  
>  
> 
> 
> Like i say if i loop through the widgets (or maybe the subwidgets as 
> well) it then loads in the JSF.  so it lazy loads in java but not in 
> JSF.  should i change to eager when i generate the entities or is there 
> something else i can do?  is it supposed to work the same as eclipselink?
> 
> 
> On 02/11/2016 08:06, Mark Struberg wrote:
>>  Hi Matthew!
>> 
>>  Now I'm back on my notebook.
>>  What transaction mechanism are you using? JTA or ResourceLocal?
>>  And what technology to control the transactions? EJBs? CDI? Spring?
>> 
>>  It boils down to be more a question about appliction architecture than 
> about OpenJPA, but still very important to cover. So just go ahead, I'm 
> pretty sure we can help you.
>> 
>>  LieGrue,
>>  strub
>> 
>>>  Am 24.10.2016 um 10:34 schrieb Matthew Broadhead 
> <matthew.broadh...@nbmlaw.co.uk>:
>>> 
>>>  HI, I am using TomEE 7.0.1 and I just switched from Plume to Plus. I 
> was using eclipselink and now I am converting to OpenJPA.  When I fetch a set 
> of 
> entities and then try to iterate through their associations in JSF the list 
> is 
> empty.  in eclipselink they were populated by default.  if i loop through the 
> entities in Java before displaying in JSF then they are populated (i guess 
> they 
> get lazy loaded).  is there a setting that needs to be changed?  like 
> generating 
> with all associations as eager or setting a flag in persistence.xml?  what 
> would 
> give the same default as eclipselink? seemed like an easy question but i 
> could 
> not find anything by searching.
> 


Re: fetching associations

2016-11-02 Thread Mark Struberg
Hi Matthew!

Now I'm back on my notebook. 
What transaction mechanism are you using? JTA or ResourceLocal?
And what technology to control the transactions? EJBs? CDI? Spring?

It boils down to be more a question about appliction architecture than about 
OpenJPA, but still very important to cover. So just go ahead, I'm pretty sure 
we can help you.

LieGrue,
strub

> Am 24.10.2016 um 10:34 schrieb Matthew Broadhead 
> :
> 
> HI, I am using TomEE 7.0.1 and I just switched from Plume to Plus. I was 
> using eclipselink and now I am converting to OpenJPA.  When I fetch a set of 
> entities and then try to iterate through their associations in JSF the list 
> is empty.  in eclipselink they were populated by default.  if i loop through 
> the entities in Java before displaying in JSF then they are populated (i 
> guess they get lazy loaded).  is there a setting that needs to be changed?  
> like generating with all associations as eager or setting a flag in 
> persistence.xml?  what would give the same default as eclipselink? seemed 
> like an easy question but i could not find anything by searching.



Re: fetching associations

2016-11-01 Thread Mark Struberg
Hi! 
I sounds like you did hit the classic lazy loading issue. eclipselink opens a 
connection again, but this is not specced. In Hibernate you will end up with a 
LazyInitializationException.
It's not an OpenJPA issue but the way transactions work in JavaEE by default.
For JSF I recommend to not use EJB transactions but a @RequestScoped 
EntityManager producer in CDI together with Apache DeltaSpike @Transactional.

Can add links later when on notebook.

lieGrue,
Strub

> Am 27.10.2016 um 21:07 schrieb gilbertoca :
> 
> I'm not entirely sure, but you need to make the enhancement of the entities
> [1].
> 
> Regards,
> 
> Gilberto
> 
> [1]
> https://openjpa.apache.org/builds/2.4.1/apache-openjpa/docs/manual.html#ref_guide_pc_enhance
> 
> 
> 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/fetching-associations-tp7589828p7589836.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: OpenJPA and TomEE 7.0.1 - 2.1 spec

2016-10-22 Thread Mark Struberg
Hi Gilbert!

the JPA-2.1 Converters are definitely on our List and we would be glad if you 
would join us with the effort to implement this feature (and others).
 
I personally didn’t yet miss this feature because the JPA-2.1 Converters are a 
bit limited to be honest.
I’d rather use the OpenJPA ValueHandlers, because they also allow you a much 
more fine grained control over how it should look in the DataBase as well.

Our ASF colleague Reinhard did write a sample on GitHub. 
We should probably use this to improve our documentation. 

https://github.com/rsandtner/openjpa-converter/tree/master/src

Would be great if could tell us what you think about it!

txs LieGrue,
strub

> Am 20.10.2016 um 15:00 schrieb gilbertoca :
> 
> Hello everyone. I hope you're having a good day. 
> 
> I'm TomEE 7 user, mainly of the amazing tomee-embedded-maven-plugin.
> Following the Romain Manni-Bucau advice from this discussion about the setup
> of Hibernate and Eclipselink setup [1], I would like to offer my help on
> OpenJPA 2.1 development. Right now my requirement is converters for
> javax.time and schema-generation. 
> I've never helped directly an open source project, just reporting issues and
> fixing some docs. I think mentoring and guideline will be needed.
> So, I want to help!
> 
> Regards,
> 
> Gilberto
> 
> https://twitter.com/Gilberto_gca
> blog.gilbertoca.com
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/OpenJPA-and-TomEE-7-0-1-2-1-spec-tp7589826.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Null field not persisted for Dates

2016-10-16 Thread Mark Struberg
Hi Vincenzo!

No worries, your english is fine. 

The writeExternal is invoked to serialize away the entity. Whether the receiver 
side gets just the normal entity fields (unenhanced so to say) or also the 
_loaded and _dirty fields is a question of the configuration. 

I usually use the following setup:
https://github.com/struberg/lightweightEE/blob/master/backend-api/src/main/resources/META-INF/persistence.xml#L26

Together with the openjpa-maven-plugin to enhance the classes at build time
https://github.com/struberg/lightweightEE/blob/master/backend-api/pom.xml#L66
I should clean up the connection section config. That's a left over from many 
years back. But it should basically work.

I've wrote up a bit about enhancement strategies many years ago, maybe it helps:
https://struberg.wordpress.com/2012/01/08/jpa-enhancement-done-right/


Do you have a small sample which we can use to reproduce the problem?

txs and LieGrue,
strub





> On Saturday, 15 October 2016, 19:25, Vincenzo D'Aniello 
>  wrote:
> > Hi, i've set this property in the persistence unit:
> 
>  value="loaded(DetachedStateField=true)"/> 
> 
> but when the entity object try to be detached, an exception
> NoSuchMethodException is thrown because openjpa try to execute the
> writeExternal method on the entity class object.
> 
> I have not understand abaut enhancer, Enhancement. There is a complete
> example how do remote ejb call with ejb entity beans?
> 
> I use Tomee 1.7.4 naturally with openejb, openjpa, sorry for my english.
> 
> 
> 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/Null-field-not-persisted-for-Dates-tp5993519p7589809.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> 


Re: trying to run JPA Console inside Intellij IDEA results in this....

2016-09-22 Thread Mark Struberg
oh another thing which makes me curious. 

IIRC then we only use the 
ProxySetupStateManager.java:230in case of subclassing if the entities did not 
get properly enhanced at all.

This means you are not using build-time enhancement and also no javaagent.

Can you please check the classfile?

$> javap -c target/classes/de/netversys/domain/Distribution.class | less


And check whether the class has a PersistenceCapable interface in the bytecode.

LieGrue,
strub




> On Thursday, 22 September 2016, 8:02, Mark Struberg 
> <strub...@yahoo.de.INVALID> wrote:
> > Yes, it contains the number of the field it has problems with as int.
> 
> Counting of fields start with the uppermost entity class. The fild numbers 
> get 
> generated during enhancement.
> 
> LieGrue,
> Strub
> 
> 
>>  Am 21.09.2016 um 23:25 schrieb Marc Logemann 
> <marc.logem...@gmail.com>:
>> 
>>  And when u look at the stacktrace on this line:
>> 
>>  at de.netversys.domain.Distribution.pcProvideField(Distribution.java)
>> 
>>  you see a method which wouldnt be there if the class is not enhanced right?
>> 
>>  2016-09-21 22:00 GMT+02:00 Mark Struberg <strub...@yahoo.de.invalid>:
>>>  MappedSuperclasses should not be any problem. At least if it got 
> enhanced as well. Are you missing this probably?
>>> 
>>>  LieGrue,
>>>  strub
>>> 
>>> 
>>> 
>>>  On Wednesday, 21 September 2016, 21:57, Marc Logemann 
> <marc.logem...@gmail.com> wrote>
>>>  >Hi,
>>>  >
>>>  >
>>>  >yeah. Every entity extends AbstractEntity which is a 
> MappedSuperclass.
>>>  >
>>>  >
>>>  >2016-09-21 20:15 GMT+02:00 Mark Struberg 
> <strub...@yahoo.de.invalid>:
>>>  >
>>>  >Hi Marc!
>>>  >>
>>>  >>Is the entity Distribution part of a supertype/subtype 
> constellation aka inheritance?
>>>  >>Does this class 'extends' something? And where do these 
> classes reside?
>>>  >>
>>>  >>
>>>  >>LieGrue,
>>>  >>strub
>>>  >>
>>>  >>
>>>  >>
>>>  >>
>>>  >>
>>>  >>
>>>  >>> On Wednesday, 21 September 2016, 18:27, Marc Logemann 
> <marc.logem...@gmail.com> wrote:
>>>  >>> > can somebody hint me where i need to look out for? 
> Quite weird message
>>>  >>>
>>>  >>>
>>>  >>> [2016-09-21 18:24:13]  fatal user error>
>>>  >>> org.apache.openjpa. persistence.ArgumentException: Errors 
> encountered while
>>>  >>> resolving metadata.  See nested exceptions for details.
>>>  >>> [2016-09-21 18:24:13] java.lang.RuntimeException:
>>>  >>> 
>>>  >>> org.apache.openjpa. persistence. PersistenceException: 
> Unexpected attribute
>>>  >>> type "int" for persistence-capable class
>>>  >>> "de.netversys.domain. Distribution"
>>>  >>> is detected. If the entity is packaged in a jar file, this 
> may be caused by
>>>  >>> one or more inherited class of the entity not being 
> packaged in the same
>>>  >>> jar file. Please check all inherited class(es) are 
> packaged in the same jar
>>>  >>> file.
>>>  >>> at
>>>  >>> org.apache.openjpa.meta. ProxySetupStateManager. 
> providedIntField( ProxySetupStateManager.java: 230)
>>>  >>> at de.netversys.domain. Distribution.pcProvideField( 
> Distribution.java)
>>>  >>> at
>>>  >>> org.apache.openjpa.meta. ProxySetupStateManager. 
> setProxyData( ProxySetupStateManager.java: 62)
>>>  >>> at
>>>  >>> org.apache.openjpa.meta. ClassMetaData.resolveMeta( 
> ClassMetaData.java:1927)
>>>  >>> at org.apache.openjpa.meta. ClassMetaData.resolve( 
> ClassMetaData.java:1808)
>>>  >>> at
>>>  >>> org.apache.openjpa.meta. MetaDataRepository. 
> processBuffer( MetaDataRepository.java:829)
>>>  >>> at
>>>  >>> org.apache.openjpa.meta. MetaDataRepository. resolveMeta( 
> MetaDataRepository.java:726)
>>>  >>> at
>>>  >>> org.apache.openjpa.meta. MetaDataRepository.resolve( 
> MetaDataRepository.java:650)
>>>  >>> at
>>>  >>> org.apache.openjpa.meta. MetaDataRepository. 
> getMetaDataInternal( MetaDataRepository.java:4

Re: trying to run JPA Console inside Intellij IDEA results in this....

2016-09-22 Thread Mark Struberg
Yes, it contains the number of the field it has problems with as int.

Counting of fields start with the uppermost entity class. The fild numbers get 
generated during enhancement.

LieGrue,
Strub

> Am 21.09.2016 um 23:25 schrieb Marc Logemann <marc.logem...@gmail.com>:
> 
> And when u look at the stacktrace on this line:
> 
> at de.netversys.domain.Distribution.pcProvideField(Distribution.java)
> 
> you see a method which wouldnt be there if the class is not enhanced right?
> 
> 2016-09-21 22:00 GMT+02:00 Mark Struberg <strub...@yahoo.de.invalid>:
>> MappedSuperclasses should not be any problem. At least if it got enhanced as 
>> well. Are you missing this probably?
>> 
>> LieGrue,
>> strub
>> 
>> 
>> 
>> On Wednesday, 21 September 2016, 21:57, Marc Logemann 
>> <marc.logem...@gmail.com> wrote>
>> >Hi,
>> >
>> >
>> >yeah. Every entity extends AbstractEntity which is a MappedSuperclass.
>> >
>> >
>> >2016-09-21 20:15 GMT+02:00 Mark Struberg <strub...@yahoo.de.invalid>:
>> >
>> >Hi Marc!
>> >>
>> >>Is the entity Distribution part of a supertype/subtype constellation aka 
>> >>inheritance?
>> >>Does this class 'extends' something? And where do these classes reside?
>> >>
>> >>
>> >>LieGrue,
>> >>strub
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>> On Wednesday, 21 September 2016, 18:27, Marc Logemann 
>> >>> <marc.logem...@gmail.com> wrote:
>> >>> > can somebody hint me where i need to look out for? Quite weird 
>> >>> > message
>> >>>
>> >>>
>> >>> [2016-09-21 18:24:13] 
>> >>> org.apache.openjpa. persistence.ArgumentException: Errors encountered 
>> >>> while
>> >>> resolving metadata.  See nested exceptions for details.
>> >>> [2016-09-21 18:24:13] java.lang.RuntimeException:
>> >>> 
>> >>> org.apache.openjpa. persistence. PersistenceException: Unexpected 
>> >>> attribute
>> >>> type "int" for persistence-capable class
>> >>> "de.netversys.domain. Distribution"
>> >>> is detected. If the entity is packaged in a jar file, this may be caused 
>> >>> by
>> >>> one or more inherited class of the entity not being packaged in the same
>> >>> jar file. Please check all inherited class(es) are packaged in the same 
>> >>> jar
>> >>> file.
>> >>> at
>> >>> org.apache.openjpa.meta. ProxySetupStateManager. providedIntField( 
>> >>> ProxySetupStateManager.java: 230)
>> >>> at de.netversys.domain. Distribution.pcProvideField( Distribution.java)
>> >>> at
>> >>> org.apache.openjpa.meta. ProxySetupStateManager. setProxyData( 
>> >>> ProxySetupStateManager.java: 62)
>> >>> at
>> >>> org.apache.openjpa.meta. ClassMetaData.resolveMeta( 
>> >>> ClassMetaData.java:1927)
>> >>> at org.apache.openjpa.meta. ClassMetaData.resolve( 
>> >>> ClassMetaData.java:1808)
>> >>> at
>> >>> org.apache.openjpa.meta. MetaDataRepository. processBuffer( 
>> >>> MetaDataRepository.java:829)
>> >>> at
>> >>> org.apache.openjpa.meta. MetaDataRepository. resolveMeta( 
>> >>> MetaDataRepository.java:726)
>> >>> at
>> >>> org.apache.openjpa.meta. MetaDataRepository.resolve( 
>> >>> MetaDataRepository.java:650)
>> >>> at
>> >>> org.apache.openjpa.meta. MetaDataRepository. getMetaDataInternal( 
>> >>> MetaDataRepository.java:418)
>> >>> at
>> >>> org.apache.openjpa.meta. MetaDataRepository. getMetaData( 
>> >>> MetaDataRepository.java:389)
>> >>> at
>> >>> org.apache.openjpa.meta. MetaDataRepository. getMetaData( 
>> >>> MetaDataRepository.java:472)
>> >>> at
>> >>> org.apache.openjpa.kernel. jpql.JPQLExpressionBuilder. getClassMetaData( 
>> >>> JPQLExpressionBuilder.java: 175)
>> >>> at
>> >>> org.apache.openjpa.kernel. jpql.JPQLExpressionBuilder. 
>> >>> resolveClassMetaData( JPQLExpressionBuilder.java: 151)
>> >>> at
>> >>> org.apache.openjpa.kernel. jpql.JPQLExpression

Re: trying to run JPA Console inside Intellij IDEA results in this....

2016-09-21 Thread Mark Struberg
Hi Marc!

Is the entity Distribution part of a supertype/subtype constellation aka 
inheritance?
Does this class 'extends' something? And where do these classes reside?


LieGrue,
strub





> On Wednesday, 21 September 2016, 18:27, Marc Logemann 
>  wrote:
> > can somebody hint me where i need to look out for? Quite weird message
> 
> 
> [2016-09-21 18:24:13] 
> org.apache.openjpa.persistence.ArgumentException: Errors encountered while
> resolving metadata.  See nested exceptions for details.
> [2016-09-21 18:24:13] java.lang.RuntimeException:
> 
> org.apache.openjpa.persistence.PersistenceException: Unexpected attribute
> type "int" for persistence-capable class 
> "de.netversys.domain.Distribution"
> is detected. If the entity is packaged in a jar file, this may be caused by
> one or more inherited class of the entity not being packaged in the same
> jar file. Please check all inherited class(es) are packaged in the same jar
> file.
> at
> org.apache.openjpa.meta.ProxySetupStateManager.providedIntField(ProxySetupStateManager.java:230)
> at de.netversys.domain.Distribution.pcProvideField(Distribution.java)
> at
> org.apache.openjpa.meta.ProxySetupStateManager.setProxyData(ProxySetupStateManager.java:62)
> at
> org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:1927)
> at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1808)
> at
> org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:829)
> at
> org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:726)
> at
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:650)
> at
> org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:418)
> at
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:389)
> at
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:472)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:175)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:151)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:241)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:211)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:204)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$200(JPQLExpressionBuilder.java:79)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:2426)
> at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:60)
> at
> org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:162)
> at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:672)
> at
> org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:653)
> at
> org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:619)
> at
> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:681)
> at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:588)
> at
> org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:996)
> at
> org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:978)
> at
> org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:101)
> at
> com.intellij.jpa.remote.impl.RemoteEntityManagerImpl.createQuery(RemoteEntityManagerImpl.java:39)
> 


[ANNOUNCE] Welcome Francesco Chicchiriccò as new OpenJPA PMC member

2016-09-15 Thread Mark Struberg
Good evening!

Please welcome Francesco Chicchiriccò as new Apache OpenJPA PMC member!

Francesco, txs for helping to push OpenJPA forward!

best regards,

the OpenJPA team


Re: weird bug with order by (2.4.1)

2016-09-11 Thread Mark Struberg
Oki, thanks for the feedback!
The reason I did ask was to know whether we introduced a regression.
If you found that it worked in older versions then please let us know. 


> ORDER BY t0.oid DESC, t24.distribution_oid ASC

Looking at your query it seems to me that those 2 columns contain the same 
values?
t0 is the table 'distribution' and t24.distribution_oid is most likely a FK 
pointing to t0. Is that correct?
In that case t0.oid and t24.distribution_oid will always be the same values? or 
is there some left outer with other id's? Is there inheritance involved 
somewhere?


LieGrue,
strub


On Sunday, 11 September 2016, 3:37, Marc Logemann <marc.logem...@gmail.com> 
wrote:
>
>I recently migrated to 2.4.1 from 2.4.0 because of this bug. So negative on 
>this one.
>
>
>In the meantime i discovered why MariaDB has index problems. Its not because 
>of the second order parameter, but because of the second order parameter which 
>is the same field in a different table but with ASC order. The ASC is the 
>thing but of course the second parameter shouldnt be there at all.
>
>
>I suspect its because of the "join fetch". Just for the record, of course i 
>dont use @OrderBy on the relation. If i do it on the 1:n relation in question, 
>i get this: ORDER BY t0.oid DESC, t24.distribution_oid ASC,  
>t24.distribution_oid ASC LIMIT ?, ?
>
>
>Perhaps i try to downgrade a bit more because i am quite sure that this 
>problem is new somehow i did another upgrade from an older version to 
>2.4.0 a few weeks ago.
>
>
>regards
>marc
>
>
>
>
>2016-09-10 9:48 GMT+02:00 Mark Struberg <strub...@yahoo.de.invalid>:
>
>Hi Marc!
>>
>>Can you please try with 2.4.0?
>>Is the generated query the same or without the column?
>>
>>LieGrue,
>>strub
>>
>>
>>
>>
>>
>>On Saturday, 10 September 2016, 2:14, Marc Logemann <marc.logem...@gmail.com> 
>>wrote:
>>
>>
>>>
>>>
>>>Hi,
>>>
>>>i suspect i found a bug which has bad consequences on MariaDB not using an
>>>index anymore. Lets take this JPAQL:
>>>
>>>select d from Distribution d join fetch d.distributionContainerList where
>>>d.client = ?1 and d.deleted = ?2 order by d.oid desc
>>>
>>>My Distribution entity is quite big when it comes to 1:n relations and
>>>stuff. So i wont get into the details here, but this  JPAQL will result in
>>>the following SQL (compressed because too big otherwise):
>>>
>>>SELECT t0.oid, t0.jpaversion, t0.created, t0.createdby, ...
>>>FROM distribution t0 LEFT OUTER JOIN dist_altfrom t1 ON t0.altfrom_oid
>>>= t1.oid
>>>LEFT OUTER JOIN clients t3 ON t0.client_oid = t3.oid LEFT OUTER
>>>JOIN
>>>cmrcarrier t17 ON t0.cmrcarrier_oid = t17.oid LEFT OUTER JOIN
>>>countries
>>>t20 ON t0.empf_country = t20.isocode2 LEFT OUTER JOIN users t21 ON
>>>t0.user_oid = t21.oid INNER JOIN dist_container t24 ON t0.oid =
>>>t24.distribution_oid LEFT OUTER JOIN countries t2 ON t1.country =
>>>t2.isocode2 LEFT OUTER JOIN address t4 ON t3.address_oid = t4.oid
>>>LEFT
>>>OUTER JOIN bankaccount t6 ON t3.bankaccount_oid = t6.oid LEFT OUTER
>>>JOIN communication t7 ON t3.communication_oid = t7.oid LEFT OUTER
>>>JOIN
>>>persons t8 ON t3.cperson_oid = t8.oid LEFT OUTER JOIN bankaccount
>>>t10
>>>ON t3.nnbankaccount_oid = t10.oid LEFT OUTER JOIN workplaces t11 ON
>>>t3.workplaceoid = t11.oid LEFT OUTER JOIN address t18 ON
>>>t17.address_oid = t18.oid LEFT OUTER JOIN communication t19 ON
>>>t17.communication_oid = t19.oid LEFT OUTER JOIN persons t22 ON
>>>t21.person_oid = t22.oid LEFT OUTER JOIN workplaces t23 ON
>>>t21.workplaceoid = t23.oid LEFT OUTER JOIN distribution t25 ON
>>>t24.old_distribution_oid = t25.oid LEFT OUTER JOIN countries t5 ON
>>>t4.country_id = t5.isocode2 LEFT OUTER JOIN communication t9 ON
>>>t8.communication_oid = t9.oid LEFT OUTER JOIN balance t12 ON
>>>t11.balance = t12.oid LEFT OUTER JOIN balance t13 ON t11.balance2 =
>>>t13.oid LEFT OUTER JOIN clients t14 ON t11.client_oid = t14.oid
>>>LEFT
>>>OUTER JOIN printer t15 ON t11.labelprinter = t15.oid LEFT OUTER
>>>JOIN
>>>printer t16 ON t11.laserprinter = t16.oid
>>>WHERE (t0.client_oid = ? AND t0.deleted = ?)
>>>ORDER BY t0.oid DESC, t24.distribution_oid ASC LIMIT ?, ?
>>>
>>>

Re: Open JPA: MetaDataException After upgrading to Open JPA 2.4.1 & Java 8

2016-08-24 Thread Mark Struberg
Do you probably have a sample application or anything you can share e.g. on 
github?

txs and LieGrue,
strub


> Am 24.08.2016 um 16:50 schrieb chris666 :
> 
> I upgraded my java app to Open JPA 2.4.1 & Java 8 & im getting the error
> below. Previously I was on Open JPA 2.2.2 & Java 7. Note, the error text
> "target does not exist in table" is not true, that field is in the table.
> 
> Any thoughts?
> 
> 
> 
> org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
> org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
> org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:280)
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
> org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
> org.springframework.cache.interceptor.CacheInterceptor$1.invoke(CacheInterceptor.java:52)
> org.springframework.cache.interceptor.CacheAspectSupport.invokeOperation(CacheAspectSupport.java:345)
> org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:414)
> org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:327)
> org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
> org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
> com.test.app.DataBCImpl$$EnhancerBySpringCGLIB$$1735a68a.getTblPpwsUserGroupDtls()
> com.test.app.common.RoleMapperGrantedAuthorityFactory.createGrantedAuthority(RoleMapperGrantedAuthorityFactory.java:36)
> waffle.spring.WindowsAuthenticationToken.(WindowsAuthenticationToken.java:84)
> waffle.spring.NegotiateSecurityFilter.doFilter(NegotiateSecurityFilter.java:108)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:100)
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
> org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
> org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
> 
> 
> 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/Open-JPA-MetaDataException-After-upgrading-to-Open-JPA-2-4-1-Java-8-tp7589507.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: OptimisticLock on Partitioned tables

2016-08-23 Thread Mark Struberg
Hi Andrej!

I will try to give it a look in the following week.
Please ping back if there is no visible progress.


LieGrue,
strub


> On Wednesday, 24 August 2016, 3:10, Andrej Badinka 
>  wrote:
> > Hi all, I created an issue in openjpa jira: 
> https://issues.apache.org/jira/browse/OPENJPA-2639 but it has no attention 
> for 
> about 4 month.
> 
> I am not sure if there is missing the demo app, as I think that the case is 
> pretty descriptive and simple:
> The db returns 0 rows affected, but openjpa awaits 1 row affected.
> 
> Is there a chance that it will get some attention, or could someone verify if 
> it 
> is invalid?
> From the posgre mailing list attached to the issue it sounds like the 
> behaviour 
> of returning 0 rows is common.
> 
> Thanks and sorry for my bad English :).
> 
> S pozdravom / Best regards
> 
> Ing. Andrej Badinka
> 
> Programátor SW aplikácií
> 
> Tel: +421 2 3278 
> 
> 
> [InterWay]
> 
> InterWay, a.s.
> 
> Sídlo:
> 
> Stará Vajnorská 21, 831 04 Bratislava
> 
> Prevádzka:
> 
> Bratislavská 29, 010 01, 
> Žilina
> 
> Web:
> 
> www.interway.sk
> 
> Ak si tento e-mail nevytlačíte, pomôžete chrániť životné prostredie.
> Please consider your environmental responsibility before printing this e-mail.
> 


Re: Open JPA Entity Loading issue due to failure in Enhancing at run time.

2016-05-17 Thread Mark Struberg
Did you enlist the classes in persistence.xml?
Please try to enlist all of them as  items and also please add
true
to your persistence.xml.
Worth a try. Without a sample project we can just try to narrow down the 
problematic zone.


Reason I'm asking is that the 'auto-pickup' is per JPA spec only working for 
the 'persistence root' of a project. Means the very same JAR where 
persistence.xml and all the entities are located in. For example if you have 
some of the entities in another jar then the entity auto-detection is not 
portably guaranteed to work anymore.


And I have not much clue how that is supposed to work in OSGi environments like 
Apache Camel (JBoss Fuse is more or less just a pre-packaged distribution of 
Apache Camel afaik). 

Fortunately we have a few Camel folks around here, maybe this sounds familiar 
to one of them?

txs and LieGrue,
strub




> On Monday, 16 May 2016, 9:11, Senthil Kumar Sekar 
> <senthilkum...@virtusapolaris.com> wrote:
> > 
> Hi Strub,
>   We have multiple bundles deployed in which dao is  a 
> separate 
> bundle and the entities are not duplicated.
> 
> xx-ds --> dao bundle
> xx depends on xx-ds
> 
> Thanks.
> 
> Regards
> Senthil Kumar Sekar
> 
> 
> From: Loganathan, Senthil <senthil.loganat...@sc.com>
> Sent: Thursday, May 12, 2016 12:13 PM
> To: Mark Struberg; users@openjpa.apache.org; Senthil Kumar Sekar
> Cc: openjpa-dev
> Subject: RE: Open JPA Entity Loading issue due to failure in Enhancing at run 
> time.
> 
> Hi Strub,
> 
> We have the entities listed in one bundle and is part of single jar file.
> Thanks.
> 
> -Original Message-
> From: Mark Struberg [mailto:strub...@yahoo.de]
> Sent: Thursday, May 12, 2016 2:23 PM
> To: users@openjpa.apache.org
> Cc: openjpa-dev; Loganathan, Senthil
> Subject: Re: Open JPA Entity Loading issue due to failure in Enhancing at run 
> time.
> 
> Do you have the same entities in multiple EARs or WARs on the same server?
> I got similar sounding issues on servers which did not properly isolate the 
> JPA 
> Metadata caches between different apps.
> Trying to understand your exact scenario is imo the first step.
> 
> LieGrue,
> strub
> 
> 
>>  Am 12.05.2016 um 05:09 schrieb Senthil Kumar Sekar 
> <senthilkum...@virtusapolaris.com>:
>> 
>> 
>> 
>>  Hello Team,
>>We have been using openjpa - 2.4.0 for our application data 
> access layer which will be deployed in Jboss Fuse 6.2.1.
>>  We have persistence xml where all the entities are declared.
>> 
>>  Very Frequently that we are facing the below issue and had to restart the 
> container multiple to get the issue resolved.
>> 
>>  java.lang.reflect.UndeclaredThrowableException
>> at com.sun.proxy.$Proxy29.createQuery(Unknown Source)
>> at 
> com.mysema.query.jpa.impl.AbstractJPAQuery.createQuery(AbstractJPAQuery.java:127)[744:com.mysema.querydsl.jpa:3.6.3]
>>
>>  Caused by: java.lang.reflect.UndeclaredThrowableException
>> at com.sun.proxy.$Proxy103.createQuery(Unknown Source)
>> ... 67 more
>>  Caused by: java.lang.reflect.InvocationTargetException
>> at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source)
>> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_79]
>> at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_79]
>> at 
> org.apache.aries.jpa.container.impl.EntityManagerProxyFactory$EMHandler.invoke(EntityManagerProxyFactory.java:31)
>> ... 68 more
>>  Caused by: 
>>  org.apache.openjpa.persistence.ArgumentException: An error occurred
>>  while parsing the query filter "select cETAssignmentException_ from 
> CETAssignmentException cETAssignmentException_ where 
> lower(cETAssignmentException_.id.officeCode) = ?1 and 
> lower(cETAssignmentException_.id.businessSegmentCode) = ?2". Error message: 
> The name "CETAssignmentException" is not a recognized entity or 
> identifier. Perhaps you meant CDDCaseLocation, which is a close match. Known 
> entity names: [IndividualReferencesAsu, RmaExcllist, 
> WbSanctionsQuestionnaire, 
> IndividualAsu, SpeDocumentsChecklist, Property, MvSciClientGrpInfo, 
> CddAdditionalDetails, CopiFatcaSubownersInfo, DocumentTemplate, 
> ClientBranchOffices, RoccoDecisionReportPK, CddCaseActorsPK, DdCase, 
> ClientIndividualReln, EcddSciCasePublish, ForeignExchange, CaseDetail, 
> CopiFatcaTaxInfo, NorkomTxn, CopiFatcaDocument, ClientGroup, 
> ClientIndividual, 
> OpaScreen, Country, MvSciClientInfo, I

Re: Open JPA Entity Loading issue due to failure in Enhancing at run time.

2016-05-12 Thread Mark Struberg
Do you have the same entities in multiple EARs or WARs on the same server?
I got similar sounding issues on servers which did not properly isolate the JPA 
Metadata caches between different apps.
Trying to understand your exact scenario is imo the first step.

LieGrue,
strub


> Am 12.05.2016 um 05:09 schrieb Senthil Kumar Sekar 
> :
> 
> 
> 
> Hello Team,
>   We have been using openjpa – 2.4.0 for our application data 
> access layer which will be deployed in Jboss Fuse 6.2.1.
> We have persistence xml where all the entities are declared.
> 
> Very Frequently that we are facing the below issue and had to restart the 
> container multiple to get the issue resolved.
> 
> java.lang.reflect.UndeclaredThrowableException
>at com.sun.proxy.$Proxy29.createQuery(Unknown Source)
>at 
> com.mysema.query.jpa.impl.AbstractJPAQuery.createQuery(AbstractJPAQuery.java:127)[744:com.mysema.querydsl.jpa:3.6.3]
>   ….
> Caused by: java.lang.reflect.UndeclaredThrowableException
>at com.sun.proxy.$Proxy103.createQuery(Unknown Source)
>... 67 more
> Caused by: java.lang.reflect.InvocationTargetException
>at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source)
>at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_79]
>at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_79]
>at 
> org.apache.aries.jpa.container.impl.EntityManagerProxyFactory$EMHandler.invoke(EntityManagerProxyFactory.java:31)
>... 68 more
> Caused by:  
> org.apache.openjpa.persistence.ArgumentException: An error occurred while 
> parsing the query filter "select cETAssignmentException_
> from CETAssignmentException cETAssignmentException_
> where lower(cETAssignmentException_.id.officeCode) = ?1 and 
> lower(cETAssignmentException_.id.businessSegmentCode) = ?2". Error message: 
> The name "CETAssignmentException" is not a recognized entity or identifier. 
> Perhaps you meant CDDCaseLocation, which is a close match. Known entity 
> names: [IndividualReferencesAsu, RmaExcllist, WbSanctionsQuestionnaire, 
> IndividualAsu, SpeDocumentsChecklist, Property, MvSciClientGrpInfo, 
> CddAdditionalDetails, CopiFatcaSubownersInfo, DocumentTemplate, 
> ClientBranchOffices, RoccoDecisionReportPK, CddCaseActorsPK, DdCase, 
> ClientIndividualReln, EcddSciCasePublish, ForeignExchange, CaseDetail, 
> CopiFatcaTaxInfo, NorkomTxn, CopiFatcaDocument, ClientGroup, 
> ClientIndividual, OpaScreen, Country, MvSciClientInfo, IndividualNorkom, 
> CddRisks, IndividualNorkomAsu, ClientOfficeProducts, CddCaseAuditPK, 
> AtfFieldsMaster, CddDdrBasedRouting, PreScreening, CddCasePK, 
> MvSciClientOrgInfo, WorkflowState, RoccoRequest, RoccoRequestAuditPK, Risks, 
> MvSciClientAddrInfo, GaProductTransaction, ClientDocuments, Bba, 
> ClientBranch, ClientNorkomPK, ClientISIC, MvSciArmCodeInfo, DDCCountries, 
> Client, GroupNorkom, IndividualClientReln, Ga, OPARuleBases, 
> CDDWorkflowState, SubReasonCodes, MoneyMarket, OpaError, DefenceGoodsStatus, 
> CDDStateMachine, LegalConstitution, ReasonCodes, RoccoRequestAudit, Address, 
> BranchNorkom, FiDocumentsChecklist, CopiFatcaStatusInfo, CddCase, Cdd, 
> CddPepSummary, Bonds, BbaDocumentsChecklist, ClientOffice, CDDCaseLocation, 
> MvSciEmpInfo, GaDocumentChecklist, TaskBasedReasonCodes, BranchAddress, 
> DgStatusDecisionMatrix, CashEquities, IndividualReferences, EcddSciPublish, 
> CddCaseAudit, BusinessSubSegment, OPACases, ClientIndividualRelnPK, 
> IndividualReferencesAsuPK, Product, ClientNorkom, BusinessSegment, 
> DocumentCategory, CoDocumentsChecklist, CddCaseAuditSubReasons, 
> IndividualClientRelnAsu, TaskBasedReasonCodesPK, CustomerCountryRisk, 
> PreScreeningComment, BbaRiskQuestion, IndividualDocuments, FormButton, 
> Documents, BbaAdditionalDetails, ClientType, GuarantorNorkomPK, 
> AnticipatedTransaction, CddPepDetail, GoodsType, CddCaseActors, 
> GuarantorNorkom, CddCountryRisk, CountryOffices, CopiFatca, 
> CddWorkflowReassignment, Norkom, Deferral, DocumentsUpload, 
> ClientTriggerEvents, CopiFatcaStatus, Gic, BusinessSubSegmentPK, 
> ParentGroupDetails, MvSciClientCoreInfo, RequestMap, CddRiskQuestions, 
> DefenceGoods, OPADecisionReport, AtfRequestTxn, Individual, ReviewCases, 
> MvSciArmLocation, DefenceGoodsDecision, ClientIndividualPK, 
> RoccoDecisionReport, IndividualPK, CddTaskAction, PreScreeningRef, 
> ClientGuarantor, Derivative]
>at 
> org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:118)[848:org.apache.openjpa:2.4.0]
>at 
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:193)[848:org.apache.openjpa:2.4.0]
>at 
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:166)[848:org.apache.openjpa:2.4.0]
> 
> Looks like the entity CETAssignmentException is not 

Re: UUID generators worth the effort?

2016-04-13 Thread Mark Struberg
For the application it's a String. JPA doesn't need to know whether this String 
represents a uuid or a random number you did yourself. It just needs to be 
unique!

LieGrue,
strub






> On Tuesday, 12 April 2016, 17:08, Francesco Chicchiriccò 
> <ilgro...@apache.org> wrote:
> > On 12/04/2016 16:11, Mark Struberg wrote:
>>>  you are not interested in making the approach below more general -
>>  'not interested' is not the right word. Not on my personal list of 
> important things for me personal - but happy to get patches!
> 
> Sure :-)
> But then I need some hint in finding how to recognize when the mapped 
> field is java.util.UUID (rather than String).
> 
>>>  4. I have opened OPENJPA2640 and provided a patch
>>  Thanks a lot, trying to get around it the next days. Feel free to poke me 
> for it ;)
> 
> Perfect, thanks.
> Regards.
> 
> 
>>>  On Tuesday, 12 April 2016, 15:51, Francesco Chicchiriccò 
> <ilgro...@apache.org> wrote:
>>>>  Hi Mark,
>>>  with reference to my 4 questions below:
>>> 
>>>  1. I have experimented that, even though UUIDType4HexSeq provides a
>>>  static getInstance() method, it is not called with my use case, so I am
>>>  fine with my UUIDGenerator's constructor being invoked twice (e.g. 
> one
>>>  time for each entity)
>>> 
>>>  2. I have been able to translate the sequence generator definition to
>>>  orm.xml
>>> 
>>>  3. I understand that since "some DBs are not really working with 
> it",
>>>  you are not interested in making the approach below more general -
>>>  that's fine, we are going to use it anyway, for the DBs we support
>>> 
>>>  4. I have opened OPENJPA2640 and provided a patch, please take a look -
>>>  incidentally, I have noticed that 2.4.1 appears as unreleased in JIRA
>>> 
>>>  Regards.
>>> 
>>> 
>>>  On 12/04/2016 09:22, Mark Struberg wrote:
>>>>Hi Francesco!
>>>> 
>>>>I usually let the PK be a String and create the UUID myself in 
> Java.
>>>> 
>>>>The 'uuid' generator is a nice feature but it's not 
> portable.
>>>> 
>>>>And that might be the reason why some DBs are not really working 
> with it -
>>>  it's simply not that frequently used.
>>>> 
>>>>There are 3 ways to create the UUID.
>>>> 
>>>>a.) In the default ct. That might trigger a tad too often and 
> might slow
>>>  down selects, etc.
>>>>b.) Lazily in getId(). If null -> create a new UUID
>>>>c.) Via an own ct which takes the UUID pk. You basically create 
> the ID in
>>>  your business layer.
>>>>I mostly use c) if I need a UUID pk.
>>>> 
>>>>LieGrue,
>>>>strub
>>>> 
>>>> 
>>>> 
>>>> 
>>>>>On Monday, 11 April 2016, 9:02, Francesco Chicchiriccò
>>>  <ilgro...@apache.org> wrote:
>>>>>>Hi all,
>>>>>I went further and built a sample POC [10] which mimics the 
> essentials
>>>>>from Syncope.
>>>>> 
>>>>>I have defined an UUIDGenerator implementing Seq (and relying 
> on [3]
>>>  for
>>>>>UUID generation), and declared it via
>>>>> 
>>>>>@SequenceGenerator(name = "uuid", sequenceName =
>>>>>   
> "net.tirasa.ilgrosso.uuidpoc.openjpa.UUIDGenerator()")
>>>>> 
>>>>>in the @MappedSuperclass of both JPA entities available, plus 
> defined
>>>>> 
>>>>>  @Id
>>>>>  @GeneratedValue(strategy = GenerationType.SEQUENCE, 
> generator =
>>>>>"uuid")
>>>>>  private UUID id;
>>>>> 
>>>>>in both entities.
>>>>> 
>>>>>I have also extended the H2Dictionary to support the native 
> UUID type
>>>>>(without such extension, the id column would have had type 
> BLOB).
>>>>> 
>>>>>All this above seems to work - at least for the simple JUnit 
> test case
>>>>>provided; I have some questions, though:
>>>>> 
>>>>>1. I have experimented that UUIDGenerator is instantiated 
> twice: would
>>>>>it be possible to defined it as singleton - as it happens for
>>>  OpenJPA's
>>>>>   

Re: Project activity

2016-01-16 Thread Mark Struberg
I hope to find a bit time next week to merge over all the stuff from trunk into 
the JPA-2.1 feature branch.
If anyone is interested to help then go on and shout out. I’ll try to apply as 
fast as I can ;)

LieGrue,
strub

> Am 15.01.2016 um 14:53 schrieb RadeMartinovic :
> 
> So, this looks more like management problem then problem with the devs not
> willing to push JPA 2.1 forward.
> 
> Would it help if you ask ASF to help you with the management part?
> 
> 
> 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/Project-activity-tp7588789p7588816.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Project activity

2016-01-16 Thread Mark Struberg
Btw quick tip for creating patches. Please always create the patch directly 
from the project root. Makes it a bit easier to apply.

txs and LieGrue,
strub


> Am 16.01.2016 um 09:43 schrieb Mark Struberg <strub...@yahoo.de>:
> 
> I hope to find a bit time next week to merge over all the stuff from trunk 
> into the JPA-2.1 feature branch.
> If anyone is interested to help then go on and shout out. I’ll try to apply 
> as fast as I can ;)
> 
> LieGrue,
> strub
> 
>> Am 15.01.2016 um 14:53 schrieb RadeMartinovic <r...@rcub.bg.ac.rs>:
>> 
>> So, this looks more like management problem then problem with the devs not
>> willing to push JPA 2.1 forward.
>> 
>> Would it help if you ask ASF to help you with the management part?
>> 
>> 
>> 
>> --
>> View this message in context: 
>> http://openjpa.208410.n2.nabble.com/Project-activity-tp7588789p7588816.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> 



Re: Project activity

2016-01-16 Thread Mark Struberg
Oh and yet another tip:

$> mvn clean install -Dsurefire.excludes.locking=**/*

as documented in openjpa-project/BUILDING.txt
This heavily reduced build time as it skips all the timeout tests where we need 
to sleep 2 minutes for each test which alone takes >30 mins overall.

LieGrue,
strub


> Am 16.01.2016 um 09:47 schrieb Mark Struberg <strub...@yahoo.de>:
> 
> Btw quick tip for creating patches. Please always create the patch directly 
> from the project root. Makes it a bit easier to apply.
> 
> txs and LieGrue,
> strub
> 
> 
>> Am 16.01.2016 um 09:43 schrieb Mark Struberg <strub...@yahoo.de>:
>> 
>> I hope to find a bit time next week to merge over all the stuff from trunk 
>> into the JPA-2.1 feature branch.
>> If anyone is interested to help then go on and shout out. I’ll try to apply 
>> as fast as I can ;)
>> 
>> LieGrue,
>> strub
>> 
>>> Am 15.01.2016 um 14:53 schrieb RadeMartinovic <r...@rcub.bg.ac.rs>:
>>> 
>>> So, this looks more like management problem then problem with the devs not
>>> willing to push JPA 2.1 forward.
>>> 
>>> Would it help if you ask ASF to help you with the management part?
>>> 
>>> 
>>> 
>>> --
>>> View this message in context: 
>>> http://openjpa.208410.n2.nabble.com/Project-activity-tp7588789p7588816.html
>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>> 
> 



Re: Project activity

2016-01-14 Thread Mark Struberg
Romain started the JPA-2.1 work but we might need a bit more hands on that. 

I will also come back to openjpa in a few weeks (need to finish some other 
projects) and can put some time into it again.

LieGrue,
strub


> Am 13.01.2016 um 14:43 schrieb RadeMartinovic :
> 
> I fear that project has slowed down considerably.
> 
> I remember back in 2014 and 2015 that there were pleads from project members
> for more community involvement. In days when they were racing toward JPA 2.0
> OpenJPA was the second implementation in the world to support all the
> features fully - and mostly because most of those were already there in
> OpenJPA or were easy to implement. 
> 
> It just seems that there is waning interest in OpenJPA.
> 
> 
> 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/Project-activity-tp7588789p7588807.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: OpenJPA openjpa-maven-plugin version 2.2.3 missing in maven central

2015-10-06 Thread Mark Struberg
Hi Tom!

openjpa-2.2.3 is simply not yet released.

The latest released JPA-2.0 compatible version is 2.4.0. 
It should contain all the fixes from 2.2.3 plus new features (e.g. 
BooleanRepresentation) and further bug fixes.

LieGrue,
strub



> Am 02.10.2015 um 22:46 schrieb tom.edwards 
> :
> 
> I guess I should actually mention that all maven dependencies for OpenJPA
> 2.2.3 do not exist in maven central.  I did try to grab the latest and
> build, but it seems that what is on the 2.2.x branch has the version set to
> 2.2.3-SNAPSHOT.
> 
> 
> 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/OpenJPA-openjpa-maven-plugin-version-2-2-3-missing-in-maven-central-tp7588565p7588566.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Is OpenJPA 2.4.0 is released or not

2015-09-30 Thread Mark Struberg
Hi Henno, 
big thanks for doing the tests and also for giving us the feedback!
We also use 2.4.0 in production already without any issues - well, at least 
without any regressions ;)

LieGrue,
strub


> Am 21.09.2015 um 09:44 schrieb Henno Vermeulen :
> 
> The documentation does list 2.4.0 as a release so I think they just forgot to 
> update the downloads page!
> I'm no OpenJPA committer, perhaps they can give the "official" answer, but 
> here's our practical answer:
> 
> We are using OpenJPA for a few years now. I can confirm from our experience 
> that the enhancer for OpenJPA 2.3.0 is not able to enhance classes that are 
> compiled with Java 8. It should be possible to compile with Java 7 and use a 
> Java 8 runtime, but we haven't tried this.
> 
> We have been using 2.4.0 with Java 7 in production (around 20 users) for 
> quite a few months. We have very thorough tests that use OpenJPA and the 
> actual database. All of them were passing on 2.3.0 and Java 7 and are now 
> passing on 2.4.0 with either Java 7 or 8, so for us there are no new bugs in 
> 2.4.0 on top of Java 8.
> 
> We actually started using Java 8 in production since this weekend, due to 
> extensive testing I'm confident everything works fine. I can't yet say 
> whether lambdas inside entities are working correctly, but I don't see why 
> they shouldn't.
> 
> In short: I would say it's safe to use OpenJPA 2.4.0 and it won't be a 
> barrier to adopt Java 8. 
> If you encounter other barriers for Java 8 adoption, consider compiling with 
> Java 7 but running with a recent Java 8 JRE. 
> 
> Henno Vermeulen
> 
> -Oorspronkelijk bericht-
> Van: Talden [mailto:tal...@gmail.com] 
> Verzonden: vrijdag 18 september 2015 5:00
> Aan: users@openjpa.apache.org
> Onderwerp: Is OpenJPA 2.4.0 is released or not
> 
> OpenJPA 2.4.0 appears to be available on MavenCentral (Dated 2015-04-20)
> 
> http://search.maven.org/#artifactdetails|org.apache.openjpa|openjpa|2.4.0|bundle
> 
> In mailing list archives there's a call to vote (With votes up to
> 2015-04-24)
> 
> http://openjpa.208410.n2.nabble.com/VOTE-Release-Apache-OpenJPA-2-4-0-tt7587965.html#none
> 
> But on the OpenJPA apache site the releases include only 2.3.0
> 
> 
> Is 2.4.0 officially released?
> 
> Is the April 20th 2015 artefact in Maven Central (that pre-dates the vote) a 
> safe and valid build for production purposes?
> 
> Am I correct that this version is required to enhance classes in a Java8 
> runtime? A Java8 migration is highly desirable but wonder if OpenJPA will be 
> a barrier.
> 
> If 2.4.0 was not officially released, is there a release coming?
> 
> --
> Aaron Scott-Boddendijk



Re: Is OpenJPA 2.4.0 is released or not

2015-09-30 Thread Mark Struberg
I fixed the most important links now. 
Can you plz check if it’s ok now?
And thanks for reporting it - this is important feedback as I’m most times too 
busy and forget about those things ;)

If you still miss something then plz ping me and I try to fix it as well.

txs and LieGrue,
strub



> Am 30.09.2015 um 16:55 schrieb Mark Struberg <strub...@yahoo.de>:
> 
> working on this now.
> Will keep you updated.
> 
> LieGrue,
> strub
> 
> 
>> Am 21.09.2015 um 23:06 schrieb Talden <tal...@gmail.com>:
>> 
>> The OpenJPA pages on apache.org (http://openjpa.apache.org/) are the
>> obvious standouts.
>> 
>> They still suggest the latest stable is 2.3.0 and say things like "The
>> upcoming 2.4 release (trunk) is based off of the 2.3.x branch and will
>> contain some additional features (TBD)"
>> 
>> --
>> Aaron Scott-Boddendijk
>> 
>> On Tue, Sep 22, 2015 at 2:24 AM, Mark Struberg <strub...@yahoo.de> wrote:
>> 
>>> It is officially released. Maybe I/we forgot to update some site still?
>>> 
>>> Just point me to the page you are missing something on and I gonna fix it.
>>> 
>>> txs and LieGrue,
>>> strub
>>> 
>>> 
>>>> Am 21.09.2015 um 09:44 schrieb Henno Vermeulen <he...@huizemolenaar.nl>:
>>>> 
>>>> The documentation does list 2.4.0 as a release so I think they just
>>> forgot to update the downloads page!
>>>> I'm no OpenJPA committer, perhaps they can give the "official" answer,
>>> but here's our practical answer:
>>>> 
>>>> We are using OpenJPA for a few years now. I can confirm from our
>>> experience that the enhancer for OpenJPA 2.3.0 is not able to enhance
>>> classes that are compiled with Java 8. It should be possible to compile
>>> with Java 7 and use a Java 8 runtime, but we haven't tried this.
>>>> 
>>>> We have been using 2.4.0 with Java 7 in production (around 20 users) for
>>> quite a few months. We have very thorough tests that use OpenJPA and the
>>> actual database. All of them were passing on 2.3.0 and Java 7 and are now
>>> passing on 2.4.0 with either Java 7 or 8, so for us there are no new bugs
>>> in 2.4.0 on top of Java 8.
>>>> 
>>>> We actually started using Java 8 in production since this weekend, due
>>> to extensive testing I'm confident everything works fine. I can't yet say
>>> whether lambdas inside entities are working correctly, but I don't see why
>>> they shouldn't.
>>>> 
>>>> In short: I would say it's safe to use OpenJPA 2.4.0 and it won't be a
>>> barrier to adopt Java 8.
>>>> If you encounter other barriers for Java 8 adoption, consider compiling
>>> with Java 7 but running with a recent Java 8 JRE.
>>>> 
>>>> Henno Vermeulen
>>>> 
>>>> -Oorspronkelijk bericht-
>>>> Van: Talden [mailto:tal...@gmail.com]
>>>> Verzonden: vrijdag 18 september 2015 5:00
>>>> Aan: users@openjpa.apache.org
>>>> Onderwerp: Is OpenJPA 2.4.0 is released or not
>>>> 
>>>> OpenJPA 2.4.0 appears to be available on MavenCentral (Dated 2015-04-20)
>>>> 
>>>> 
>>> http://search.maven.org/#artifactdetails|org.apache.openjpa|openjpa|2.4.0|bundle
>>>> 
>>>> In mailing list archives there's a call to vote (With votes up to
>>>> 2015-04-24)
>>>> 
>>>> 
>>> http://openjpa.208410.n2.nabble.com/VOTE-Release-Apache-OpenJPA-2-4-0-tt7587965.html#none
>>>> 
>>>> But on the OpenJPA apache site the releases include only 2.3.0
>>>> 
>>>> 
>>>> Is 2.4.0 officially released?
>>>> 
>>>> Is the April 20th 2015 artefact in Maven Central (that pre-dates the
>>> vote) a safe and valid build for production purposes?
>>>> 
>>>> Am I correct that this version is required to enhance classes in a Java8
>>> runtime? A Java8 migration is highly desirable but wonder if OpenJPA will
>>> be a barrier.
>>>> 
>>>> If 2.4.0 was not officially released, is there a release coming?
>>>> 
>>>> --
>>>> Aaron Scott-Boddendijk
>>> 
>>> 
> 



Re: Is OpenJPA 2.4.0 is released or not

2015-09-30 Thread Mark Struberg
working on this now.
Will keep you updated.

LieGrue,
strub


> Am 21.09.2015 um 23:06 schrieb Talden <tal...@gmail.com>:
> 
> The OpenJPA pages on apache.org (http://openjpa.apache.org/) are the
> obvious standouts.
> 
> They still suggest the latest stable is 2.3.0 and say things like "The
> upcoming 2.4 release (trunk) is based off of the 2.3.x branch and will
> contain some additional features (TBD)"
> 
> --
> Aaron Scott-Boddendijk
> 
> On Tue, Sep 22, 2015 at 2:24 AM, Mark Struberg <strub...@yahoo.de> wrote:
> 
>> It is officially released. Maybe I/we forgot to update some site still?
>> 
>> Just point me to the page you are missing something on and I gonna fix it.
>> 
>> txs and LieGrue,
>> strub
>> 
>> 
>>> Am 21.09.2015 um 09:44 schrieb Henno Vermeulen <he...@huizemolenaar.nl>:
>>> 
>>> The documentation does list 2.4.0 as a release so I think they just
>> forgot to update the downloads page!
>>> I'm no OpenJPA committer, perhaps they can give the "official" answer,
>> but here's our practical answer:
>>> 
>>> We are using OpenJPA for a few years now. I can confirm from our
>> experience that the enhancer for OpenJPA 2.3.0 is not able to enhance
>> classes that are compiled with Java 8. It should be possible to compile
>> with Java 7 and use a Java 8 runtime, but we haven't tried this.
>>> 
>>> We have been using 2.4.0 with Java 7 in production (around 20 users) for
>> quite a few months. We have very thorough tests that use OpenJPA and the
>> actual database. All of them were passing on 2.3.0 and Java 7 and are now
>> passing on 2.4.0 with either Java 7 or 8, so for us there are no new bugs
>> in 2.4.0 on top of Java 8.
>>> 
>>> We actually started using Java 8 in production since this weekend, due
>> to extensive testing I'm confident everything works fine. I can't yet say
>> whether lambdas inside entities are working correctly, but I don't see why
>> they shouldn't.
>>> 
>>> In short: I would say it's safe to use OpenJPA 2.4.0 and it won't be a
>> barrier to adopt Java 8.
>>> If you encounter other barriers for Java 8 adoption, consider compiling
>> with Java 7 but running with a recent Java 8 JRE.
>>> 
>>> Henno Vermeulen
>>> 
>>> -Oorspronkelijk bericht-
>>> Van: Talden [mailto:tal...@gmail.com]
>>> Verzonden: vrijdag 18 september 2015 5:00
>>> Aan: users@openjpa.apache.org
>>> Onderwerp: Is OpenJPA 2.4.0 is released or not
>>> 
>>> OpenJPA 2.4.0 appears to be available on MavenCentral (Dated 2015-04-20)
>>> 
>>> 
>> http://search.maven.org/#artifactdetails|org.apache.openjpa|openjpa|2.4.0|bundle
>>> 
>>> In mailing list archives there's a call to vote (With votes up to
>>> 2015-04-24)
>>> 
>>> 
>> http://openjpa.208410.n2.nabble.com/VOTE-Release-Apache-OpenJPA-2-4-0-tt7587965.html#none
>>> 
>>> But on the OpenJPA apache site the releases include only 2.3.0
>>> 
>>> 
>>> Is 2.4.0 officially released?
>>> 
>>> Is the April 20th 2015 artefact in Maven Central (that pre-dates the
>> vote) a safe and valid build for production purposes?
>>> 
>>> Am I correct that this version is required to enhance classes in a Java8
>> runtime? A Java8 migration is highly desirable but wonder if OpenJPA will
>> be a barrier.
>>> 
>>> If 2.4.0 was not officially released, is there a release coming?
>>> 
>>> --
>>> Aaron Scott-Boddendijk
>> 
>> 



Re: Is OpenJPA 2.4.0 is released or not

2015-09-21 Thread Mark Struberg
It is officially released. Maybe I/we forgot to update some site still?

Just point me to the page you are missing something on and I gonna fix it.

txs and LieGrue,
strub


> Am 21.09.2015 um 09:44 schrieb Henno Vermeulen :
> 
> The documentation does list 2.4.0 as a release so I think they just forgot to 
> update the downloads page!
> I'm no OpenJPA committer, perhaps they can give the "official" answer, but 
> here's our practical answer:
> 
> We are using OpenJPA for a few years now. I can confirm from our experience 
> that the enhancer for OpenJPA 2.3.0 is not able to enhance classes that are 
> compiled with Java 8. It should be possible to compile with Java 7 and use a 
> Java 8 runtime, but we haven't tried this.
> 
> We have been using 2.4.0 with Java 7 in production (around 20 users) for 
> quite a few months. We have very thorough tests that use OpenJPA and the 
> actual database. All of them were passing on 2.3.0 and Java 7 and are now 
> passing on 2.4.0 with either Java 7 or 8, so for us there are no new bugs in 
> 2.4.0 on top of Java 8.
> 
> We actually started using Java 8 in production since this weekend, due to 
> extensive testing I'm confident everything works fine. I can't yet say 
> whether lambdas inside entities are working correctly, but I don't see why 
> they shouldn't.
> 
> In short: I would say it's safe to use OpenJPA 2.4.0 and it won't be a 
> barrier to adopt Java 8. 
> If you encounter other barriers for Java 8 adoption, consider compiling with 
> Java 7 but running with a recent Java 8 JRE. 
> 
> Henno Vermeulen
> 
> -Oorspronkelijk bericht-
> Van: Talden [mailto:tal...@gmail.com] 
> Verzonden: vrijdag 18 september 2015 5:00
> Aan: users@openjpa.apache.org
> Onderwerp: Is OpenJPA 2.4.0 is released or not
> 
> OpenJPA 2.4.0 appears to be available on MavenCentral (Dated 2015-04-20)
> 
> http://search.maven.org/#artifactdetails|org.apache.openjpa|openjpa|2.4.0|bundle
> 
> In mailing list archives there's a call to vote (With votes up to
> 2015-04-24)
> 
> http://openjpa.208410.n2.nabble.com/VOTE-Release-Apache-OpenJPA-2-4-0-tt7587965.html#none
> 
> But on the OpenJPA apache site the releases include only 2.3.0
> 
> 
> Is 2.4.0 officially released?
> 
> Is the April 20th 2015 artefact in Maven Central (that pre-dates the vote) a 
> safe and valid build for production purposes?
> 
> Am I correct that this version is required to enhance classes in a Java8 
> runtime? A Java8 migration is highly desirable but wonder if OpenJPA will be 
> a barrier.
> 
> If 2.4.0 was not officially released, is there a release coming?
> 
> --
> Aaron Scott-Boddendijk



Re: Service returns object, but nothing is received unless toString is called!

2015-07-08 Thread Mark Struberg
Probably some lazy loading which hits you?
When does the EntityManager get closed? You do not touch anything from the 
entity before the EntityManager gets closed? In that case this might be 
perfectly covered by the JPA spec.

Which form of enhancement do you use? build-time, classtransformer via 
javaagent or subclassing?
Can you check in the debugger which StateManager is in the entity instance? 
DetachStateManager or StateManagerImpl?

LieGrue,
strub


 Am 04.07.2015 um 11:07 schrieb Jim Talbut jtal...@spudsoft.co.uk:
 
 Hi,
 
 I have this class:
 @Transactional
 @Component
 public class ProjectTransactionsImpl implements ProjectTransactions {
 
@SuppressWarnings(constantname)
private static final Logger logger = 
 LoggerFactory.getLogger(ProjectTransactionsImpl.class);
 
@Autowired
private ProviderService providerService;
 
@Override
public Provider findProvider(String providerId) {
Provider provider = providerService.find(providerId);
logger.debug(Returning: {}, provider.getClass());
return provider;
}
 }
 
 And a unit test calling it like this:
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = {file:src/test/resources/testContext.xml})
 @TransactionConfiguration(transactionManager = transactionManager, 
 defaultRollback = false)
 public class MigrateProjects extends AbstractMigrationClass {
 
private static final Logger logger = 
 LoggerFactory.getLogger(MigrateProjects.class);
 
@Autowired
private ProjectTransactions trans;
 
private int projectsAdded = 0;
private final MapString, Integer providerProjectCountBefore = new 
 HashMap();
 
@Test
public void test1() throws Exception {
logger.debug(Getting provider);
Provider provider = trans.findProvider(GTI);
logger.debug(Returned: {}, provider);
}
 }
 
 Using OpenJPA 2.4.0 with Spring 4.1.7.RELEASE.
 
 The log shows this:
 09:56:52.913 [main] DEBUG c.g.e.a.t.MigrateProjects - 
 [MigrateProjects.java(54) MigrateProjects::test1] Getting provider
 09:56:52.914 [main] DEBUG c.g.e.a.t.ProjectTransactionsImpl - 
 [ProjectTransactionsImpl.java(41) ProjectTransactionsImpl::findProvider] 
 Returning: class com.groupgti.esb.assessments.model.jpaimpl.ProviderImpl
 09:56:52.915 [main] DEBUG c.g.e.a.t.MigrateProjects - 
 [MigrateProjects.java(56) MigrateProjects::test1] Returned: null
 
 So I had an object in the call to findProvider, but it has become null by the 
 time if gets to the call site.
 If I change the logging line in findProvider to:
logger.debug(Returning: {}, provider);
 Then I get this:
 09:59:44.234 [main] DEBUG c.g.e.a.t.MigrateProjects - 
 [MigrateProjects.java(54) MigrateProjects::test1] Getting provider
 09:59:44.235 [main] DEBUG c.g.e.a.t.ProjectTransactionsImpl - 
 [ProjectTransactionsImpl.java(41) ProjectTransactionsImpl::findProvider] 
 Returning: ProviderImpl{id=8, providerId=GTI, projects=20, 
 maintenanceWindows=0, textBlocks=0}
 09:59:44.238 [main] DEBUG c.g.e.a.t.MigrateProjects - 
 [MigrateProjects.java(56) MigrateProjects::test1] Returned: 
 ProviderImpl{id=8, providerId=GTI, projects=20, maintenanceWindows=0, 
 textBlocks=0}
 
 So if I log the object it gets output, but if I don't I get null.
 I can't debug this because the act of debugging makes it work!
 
 If I change the logging line to:
provider.getProjects();
 Just to prove I've really got an object and to ensure that a collection gets 
 loaded.
 Then I get:
 10:01:37.101 [main] DEBUG c.g.e.a.t.MigrateProjects - 
 [MigrateProjects.java(54) MigrateProjects::test1] Getting provider
 10:01:37.109 [main] DEBUG c.g.e.a.t.MigrateProjects - 
 [MigrateProjects.java(56) MigrateProjects::test1] Returned: null
 
 If I change the logging line to:
provider.toString();
 Then it works again:
 10:03:09.843 [main] DEBUG c.g.e.a.t.MigrateProjects - 
 [MigrateProjects.java(54) MigrateProjects::test1] Getting provider
 10:03:09.847 [main] DEBUG c.g.e.a.t.MigrateProjects - 
 [MigrateProjects.java(56) MigrateProjects::test1] Returned: 
 ProviderImpl{id=8, providerId=GTI, projects=20, maintenanceWindows=0, 
 textBlocks=0}
 
 So something in toString seems to be making it work.
 The toString() implementation isn't very complicated:
@Override
public String toString() {
try {
return ProviderImpl{ + id= + id + , providerId= + providerId 
 + , projects= + projects.size() + , maintenanceWindows= + 
 maintenanceWindows.size()
+ , textBlocks= + textBlocks.size() + '}';
} catch (NullPointerException ex) {
return null;
}
}
 It's not hitting any NPE because it is returning a correct string.
 
 Can anyone shed some light on what is happening here?
 Or suggest some approach I can take to debug it?
 
 Thanks
 
 Jim
 



Re: Mapping a Join Table with Additional Columns

2015-04-27 Thread Mark Struberg
Why don’t you use a @ManyToMany relation?

LieGrue,
strub


 Am 26.04.2015 um 17:57 schrieb Marco de Booij marco.developm...@debooy.eu:
 
 I use Tomee 1.7.1 with openjpa version openjpa-2.4.0-nonfinal-1598334-r422266.
 
 I have an entity auteurs and an entity boek. They have a ManyToMany relation 
 through the entity auteurs_boeken. In this entity there is a field type to 
 define the type of the relation (writer, illustrations, ...). I followed the 
 https://en.wikibooks.org/wiki/Java_Persistence/ManyToMany page and came up 
 with the following classes (left out all constructors, getters, and setters):
 
 =
 @Entity
 @Table(name=AUTEURS, schema=BYBLOS)
 public class AuteurDto
extends Dto implements ComparableAuteurDto, Cloneable {
  private static final  long  serialVersionUID  = 1L;
 
  @Id
  @GeneratedValue(strategy=GenerationType.IDENTITY)
  @Column(name=AUTEUR_ID, nullable=false, unique=true)
  private LongauteurId;
  @Column(name=NAAM, length=100, nullable=false)
  private String  naam;
  @Column(name=VOORNAAM, length=100)
  private String  voornaam;
 
  @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy=auteur)
  private ListAuteurBoekDto boeken;
 }
 
 =
 @Entity
 @Table(name=BOEKEN, schema=BYBLOS)
 public class BoekDto extends Dto implements ComparableBoekDto, Cloneable {
  private static final  long  serialVersionUID  = 1L;
 
  @Id
  @GeneratedValue(strategy=GenerationType.IDENTITY)
  @Column(name=BOEK_ID, nullable=false, unique=true)
  private LongboekId;
  @Column(name=DEEL, precision=5, scale=0)
  private Integer deel;
  @Column(name=DRUK, precision=3, scale=0)
  private Integer druk;
  @Column(name=ISBN, length=13)
  private String  isbn;
  @Column(name=JAAR_UITGAVE, precision=4, scale=0)
  private Integer jaarUitgave;
  @Column(name=SUBDEEL, length=2)
  private String  subdeel;
  @Column(name=TAAL, length=2, nullable=false)
  private String  taal;
  @Column(name=TITEL, length=100, nullable=false)
  private String  titel;
 
  @OneToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
  @JoinColumn(name=SERIE_ID, nullable=false, updatable=false)
  private SerieDto  serie;
 
  @OneToMany(mappedBy=boek, fetch=FetchType.LAZY)
  private ListAuteurBoekDto auteurs;
 }
 
 =
 @Entity
 @Table(name=AUTEURS_BOEKEN, schema=BYBLOS)
 @IdClass(AuteurBoekPK.class)
 public class AuteurBoekDto
extends Dto implements ComparableAuteurBoekDto, Cloneable {
  private static final  long  serialVersionUID  = 1L;
 
  @Id
  private LongauteurId;
  @Id
  private LongboekId;
  @Column(name=AUTEUR_TYPE, nullable=false, length=1)
  private String  auteurType;
 
  @ManyToOne
  @PrimaryKeyJoinColumn(name=AUTEUR_ID, referencedColumnName=auteurId)
  private AuteurDto auteur;
  @ManyToOne
  @PrimaryKeyJoinColumn(name=BOEK_ID, referencedColumnName=boekId)
  private BoekDto   boek;
 }
 
 When I fetch the boeken from within the AuteurDto I get the message:
 openjpa-2.4.0-nonfinal-1598334-r422266:1599166 fatal user error 
 org.apache.openjpa.persistence.ArgumentException: 
 eu.debooy.byblos.domain.AuteurBoekDto.auteur defines a target of auteurId 
 for column AUTEUR_ID, but that target does not exist in table 
 BYBLOS.AUTEURS.
 I have the same problem on the BoekDto. BoekDto has a OneToOne relation with 
 SerieDto and when I read the boeken from there I get the correct boeken so I 
 guess that the problem lies with my implementation of the ManyToMany. Can 
 someone show me the way to the correct implementation?
 
 Regards,
 
 Marco



Re: criteria API generates a parameter for literal in group by but does not provide the value

2015-04-23 Thread Mark Struberg

Yes, we still have to get the docs and site done.
Txs for your unit test. Will try to give it a run in the next 2 days.

LieGrue,
strub



 Am 23.04.2015 um 16:07 schrieb Henno Vermeulen he...@huizemolenaar.nl:
 
 Sorry, I haven't looked at the code base, I'm still an OpenJPA user not a 
 developer.
 
 I submitted a unit test in the bug report OPENJPA-2578 criteria API group 
 by creates SQL with a parameter for a literal but does not provide it's 
 value. (Requires a trivial adjustment to be an official OpenJPA unit test).
 
 The workaround works for me but I guess this should still be fixed because 
 that forces you to use the mentioned query hint and OpenJPA 2.4.0 when using 
 boolean literals.
 
 I downloaded OpenJPA 2.4.0 today through Maven although the website doesn't 
 yet show it as released.
 Now I can move forwards to using Java 8. Good to see that all of my existing 
 (Java 7) tests that passed on 2.3.0 also pass in 2.4.0.
 
 Henno
 
 
 -Oorspronkelijk bericht-
 Van: Rick Curtis [mailto:curti...@gmail.com] 
 Verzonden: donderdag 23 april 2015 15:42
 Aan: users
 Onderwerp: Re: criteria API generates a parameter for literal in group by but 
 does not provide the value
 
 Shall I report this as a bug or am I doing something wrong in my code?
 I vote bug
 
 On Thu, Apr 23, 2015 at 6:43 AM, Mark Struberg strub...@yahoo.de wrote:
 
 Thanks Henno!
 
 Not quite sure if this workaround is good enough or whether we should 
 try to solve this properly.
 I plan to do a follow up release for 2.4.0 rather soonish. So thanks 
 for your test case.
 
 Did you already look at the OpenJPA codebase? Are you interested in 
 turning this sample code into a unit test?
 
 
 txs and LieGrue,
 strub
 
 
 
 Am 23.04.2015 um 12:32 schrieb Henno Vermeulen he...@huizemolenaar.nl:
 
 One addition (my question is still open).
 
 I can confirm that a valid workaround for this problem is to use
 setHint(openjpa.hint.UseLiteralInSQL, true) and updating to 
 OpenJPA
 2.4.0 which is available in Maven central since a few days.
 
 Henno
 
 -Oorspronkelijk bericht-
 Van: Henno Vermeulen [mailto:he...@huizemolenaar.nl]
 Verzonden: donderdag 23 april 2015 11:49
 Aan: users@openjpa.apache.org
 Onderwerp: criteria API generates a parameter for literal in group 
 by
 but does not provide the value
 
 Hello,
 
 I have a query created using the criteria API where I group by an
 expression that contains a small calculation using literal values.
 
 OpenJPA generates the correct SQL but does not provide the value of 
 the
 generated parameter in the group by clause. The query fails with a SQL 
 exception The value is not set for the parameter number 9..
 
 I can reproduce the issue with a minimal example. Suppose we have a
 person class with integer age and length columns and we wish to select 
 the average length grouped by the person's age / 10:
 
   CriteriaBuilder cb = em.getCriteriaBuilder();
   CriteriaQueryDouble query =
 cb.createQuery(Double.class);
   RootPerson person = 
 query.from(Person.class);
 
   ExpressionDouble averageLength =
 cb.avg(person.Integer get(length));
   CriteriaQueryDouble select =
 query.select(averageLength);
 
   select.groupBy(cb.quot(person.Integer
 get(age), cb.literal(10)));
   // optional where, useful to ensure 
 parameters
 are logged
   select.where(cb.gt(person.Integer 
 get(age),
 cb.literal(20)));
 
   System.out.println(result:  +
 em.createQuery(query).getResultList());
 
 Whe running this query with trace and displaying parameters on I get:
 
 1067  testPU  TRACE  [main] openjpa.Query - Executing query: Query:
 org.apache.openjpa.kernel.QueryImpl@be4f81; candidate class: class 
 entities.Person; query: null
 1108  testPU  TRACE  [main] openjpa.jdbc.SQL - t 5763249, conn 
 7326702
 executing prepstmnt 26531336 SELECT AVG(t0.length) FROM Person t0 
 WHERE (t0.age  ?) GROUP BY (t0.age / ?) [params=(int) 20]
 
 You can clearly see that the query has two parameter placeholders 
 but
 only one value is provided.
 Shall I report this as a bug or am I doing something wrong in my code?
 
 (As a workaround I can call setHint(openjpa.hint.UseLiteralInSQL,
 true) on em.createQuery(query). This doesn't work in my application 
 because there is a bug where boolean literals aren't correctly handled:
 https://issues.apache.org/jira/browse/OPENJPA-2534. I think this is 
 solved in the upcoming release.)
 
 Thank you,
 Henno
 
 
 
 
 
 --
 *Rick Curtis*



Re: [VOTE] Release Apache OpenJPA-2.4.0

2015-04-23 Thread Mark Struberg
Hi Marc!

Sorry, not yet JPA-2.1 :(
But the good news is that we are moving again ;)

I personally would really like to address JPA-2.1 in the next moths, but first 
I like to clean up a few old technical debts. 
We probably can do a parallel stream where we tackle the most important 
features of JPA-2.1. But that needs some additional hands. For this to happen I 
would also first try to make it easier to write openjpa unit tests. That would 
easy contribution quite a bit.

LieGrue,
strub



 Am 23.04.2015 um 18:50 schrieb Marc Logemann marc.logem...@gmail.com:
 
 Hi,
 
 hoped for JPA 2.1 compliance..
 
 
 
 2015-04-19 17:03 GMT+02:00 Mark Struberg strub...@yahoo.de:
 
 It’s a great pleasure to call a VOTE for releasing Apache OpenJPA-2.4.0.
 
 OpenJPA-2.4.0 implements the JPA-2.0 specification.
 
 The staging repository can be found here:
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/
 
 The Release Notes can be found in the file
 openjpa-project/RELEASE_NOTES.html and online under:
 
 https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310351version=12325298
 
 The SVN source TAG is (1674626):
 https://svn.apache.org/repos/asf/openjpa/tags/openjpa-parent-2.4.0/
 
 The source release can be found here:
 
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/openjpa-parent/2.4.0/openjpa-parent-2.4.0-source-release.zip
 
 The binary release is here:
 
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/apache-openjpa/2.4.0/apache-openjpa-2.4.0-binary.zip
 
 My Key can be found here
 https://svn.apache.org/repos/asf/openjpa/KEYS
 
 
 The VOTE will be open for 72 hours.
 [+1] approve
 [+0] meh, don’t care
 [-1] stop, I’ve found a ${fish} in there
 
 
 txs and LieGrue,
 your OpenJPA team



Re: criteria API generates a parameter for literal in group by but does not provide the value

2015-04-23 Thread Mark Struberg
Thanks Henno!

Not quite sure if this workaround is good enough or whether we should try to 
solve this properly.
I plan to do a follow up release for 2.4.0 rather soonish. So thanks for your 
test case.

Did you already look at the OpenJPA codebase? Are you interested in turning 
this sample code into a unit test?


txs and LieGrue,
strub



 Am 23.04.2015 um 12:32 schrieb Henno Vermeulen he...@huizemolenaar.nl:
 
 One addition (my question is still open).
 
 I can confirm that a valid workaround for this problem is to use 
 setHint(openjpa.hint.UseLiteralInSQL, true) and updating to OpenJPA 2.4.0 
 which is available in Maven central since a few days.
 
 Henno
 
 -Oorspronkelijk bericht-
 Van: Henno Vermeulen [mailto:he...@huizemolenaar.nl] 
 Verzonden: donderdag 23 april 2015 11:49
 Aan: users@openjpa.apache.org
 Onderwerp: criteria API generates a parameter for literal in group by but 
 does not provide the value
 
 Hello,
 
 I have a query created using the criteria API where I group by an expression 
 that contains a small calculation using literal values.
 
 OpenJPA generates the correct SQL but does not provide the value of the 
 generated parameter in the group by clause. The query fails with a SQL 
 exception The value is not set for the parameter number 9..
 
 I can reproduce the issue with a minimal example. Suppose we have a person 
 class with integer age and length columns and we wish to select the average 
 length grouped by the person's age / 10:
 
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQueryDouble query = 
 cb.createQuery(Double.class);
RootPerson person = query.from(Person.class);
 
ExpressionDouble averageLength = 
 cb.avg(person.Integer get(length));
CriteriaQueryDouble select = 
 query.select(averageLength);
 
select.groupBy(cb.quot(person.Integer get(age), 
 cb.literal(10)));
// optional where, useful to ensure parameters are 
 logged
select.where(cb.gt(person.Integer get(age), 
 cb.literal(20)));
 
System.out.println(result:  + 
 em.createQuery(query).getResultList());
 
 Whe running this query with trace and displaying parameters on I get:
 
 1067  testPU  TRACE  [main] openjpa.Query - Executing query: Query: 
 org.apache.openjpa.kernel.QueryImpl@be4f81; candidate class: class 
 entities.Person; query: null
 1108  testPU  TRACE  [main] openjpa.jdbc.SQL - t 5763249, conn 7326702 
 executing prepstmnt 26531336 SELECT AVG(t0.length) FROM Person t0 WHERE 
 (t0.age  ?) GROUP BY (t0.age / ?) [params=(int) 20]
 
 You can clearly see that the query has two parameter placeholders but only 
 one value is provided.
 Shall I report this as a bug or am I doing something wrong in my code?
 
 (As a workaround I can call setHint(openjpa.hint.UseLiteralInSQL, true) 
 on em.createQuery(query). This doesn't work in my application because there 
 is a bug where boolean literals aren't correctly handled: 
 https://issues.apache.org/jira/browse/OPENJPA-2534. I think this is solved in 
 the upcoming release.)
 
 Thank you,
 Henno
 



Re: [VOTE] Release Apache OpenJPA-2.4.0

2015-04-22 Thread Mark Struberg
+1 nonbinding

So we _still_ miss at least 1 binding vote…

LieGrue,
strub


 Am 19.04.2015 um 17:03 schrieb Mark Struberg strub...@yahoo.de:
 
 It’s a great pleasure to call a VOTE for releasing Apache OpenJPA-2.4.0.
 
 OpenJPA-2.4.0 implements the JPA-2.0 specification.
 
 The staging repository can be found here:
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/
 
 The Release Notes can be found in the file openjpa-project/RELEASE_NOTES.html 
 and online under:
 https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310351version=12325298
 
 The SVN source TAG is (1674626):
 https://svn.apache.org/repos/asf/openjpa/tags/openjpa-parent-2.4.0/
 
 The source release can be found here:
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/openjpa-parent/2.4.0/openjpa-parent-2.4.0-source-release.zip
 
 The binary release is here:
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/apache-openjpa/2.4.0/apache-openjpa-2.4.0-binary.zip
 
 My Key can be found here 
 https://svn.apache.org/repos/asf/openjpa/KEYS
 
 
 The VOTE will be open for 72 hours.
 [+1] approve
 [+0] meh, don’t care
 [-1] stop, I’ve found a ${fish} in there
 
 
 txs and LieGrue,
 your OpenJPA team



Re: [VOTE] [RESULT] Release Apache OpenJPA-2.4.0

2015-04-22 Thread Mark Struberg
Hi!

The VOTE did pass with the following:

+1: Romain (nonbinding), Kevin, Rick, Albert, Mark (nonbinding)
No -1 nor +1

Will propagate the artifacts.

LieGrue,
strub



 Am 19.04.2015 um 17:03 schrieb Mark Struberg strub...@yahoo.de:
 
 It’s a great pleasure to call a VOTE for releasing Apache OpenJPA-2.4.0.
 
 OpenJPA-2.4.0 implements the JPA-2.0 specification.
 
 The staging repository can be found here:
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/
 
 The Release Notes can be found in the file openjpa-project/RELEASE_NOTES.html 
 and online under:
 https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310351version=12325298
 
 The SVN source TAG is (1674626):
 https://svn.apache.org/repos/asf/openjpa/tags/openjpa-parent-2.4.0/
 
 The source release can be found here:
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/openjpa-parent/2.4.0/openjpa-parent-2.4.0-source-release.zip
 
 The binary release is here:
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/apache-openjpa/2.4.0/apache-openjpa-2.4.0-binary.zip
 
 My Key can be found here 
 https://svn.apache.org/repos/asf/openjpa/KEYS
 
 
 The VOTE will be open for 72 hours.
 [+1] approve
 [+0] meh, don’t care
 [-1] stop, I’ve found a ${fish} in there
 
 
 txs and LieGrue,
 your OpenJPA team



[VOTE] Release Apache OpenJPA-2.4.0

2015-04-19 Thread Mark Struberg
It’s a great pleasure to call a VOTE for releasing Apache OpenJPA-2.4.0.

OpenJPA-2.4.0 implements the JPA-2.0 specification.

The staging repository can be found here:
https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/

The Release Notes can be found in the file openjpa-project/RELEASE_NOTES.html 
and online under:
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310351version=12325298

The SVN source TAG is (1674626):
https://svn.apache.org/repos/asf/openjpa/tags/openjpa-parent-2.4.0/

The source release can be found here:
https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/openjpa-parent/2.4.0/openjpa-parent-2.4.0-source-release.zip

The binary release is here:
https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/apache-openjpa/2.4.0/apache-openjpa-2.4.0-binary.zip

My Key can be found here 
https://svn.apache.org/repos/asf/openjpa/KEYS


The VOTE will be open for 72 hours.
[+1] approve
[+0] meh, don’t care
[-1] stop, I’ve found a ${fish} in there


txs and LieGrue,
your OpenJPA team

Re: Which version of JPA (2.0 or 2.1) does openjpa 2.4 support?

2015-04-06 Thread Mark Struberg
Hi!

openjpa-2.4.0 is indeed targetting JPA-2.0.

I personally would like to  target JPA-2.1 soon, but before that I would love 
to see a few cleanup efforts being done.
E.g. cleaning up our bytecode parts and move all to xbean-asm5-shaded.

LieGrue,
strub


 Am 06.04.2015 um 11:15 schrieb David Goodenough 
 david.goodeno...@btconnect.com:
 
 According to:-
 
 http://openjpa.apache.org/jpa-2.1-development-process.html
 
 openjpa 2.4 is the release that should implement JPA 2.1.  But I am told
 on the tomee mailing list that although tomee 2.0 included an
 openjpa 2.4 snapshot it does not support jpa 2.1.
 
 I am confused, can someone enlighten me.
 
 David



Re: Which version of JPA (2.0 or 2.1) does openjpa 2.4 support?

2015-04-06 Thread Mark Struberg
 OK, so can I suggest that the web page needs updating as it is currently
 misleading.

Oh, thanks for the pointer!

 Also why do you suppose that Eclipse seems to think that the openjpa
 jar file in tomee contains a 2.1 JPA implementation rather than a 2.0 one?
 It is resisting me trying to downgrade JPA support to 2.0 with the
 2.4 jar installed.


Hmm, that’s weird indeed. But I guess this has more to do with Eclipse than 
with openjpa.

LieGrue,
strub




 Am 06.04.2015 um 13:15 schrieb David Goodenough 
 david.goodeno...@btconnect.com:
 
 OK, so can I suggest that the web page needs updating as it is currently
 misleading.
 
 Also why do you suppose that Eclipse seems to think that the openjpa
 jar file in tomee contains a 2.1 JPA implementation rather than a 2.0 one?
 It is resisting me trying to downgrade JPA support to 2.0 with the
 2.4 jar installed.
 
 David
 
 On Monday 06 April 2015 12:17:00 Mark Struberg wrote:
 Hi!
 
 openjpa-2.4.0 is indeed targetting JPA-2.0.
 
 I personally would like to  target JPA-2.1 soon, but before that I would
 love to see a few cleanup efforts being done. E.g. cleaning up our bytecode
 parts and move all to xbean-asm5-shaded.
 
 LieGrue,
 strub
 
 Am 06.04.2015 um 11:15 schrieb David Goodenough
 david.goodeno...@btconnect.com:
 
 According to:-
 
 http://openjpa.apache.org/jpa-2.1-development-process.html
 
 openjpa 2.4 is the release that should implement JPA 2.1.  But I am told
 on the tomee mailing list that although tomee 2.0 included an
 openjpa 2.4 snapshot it does not support jpa 2.1.
 
 I am confused, can someone enlighten me.
 
 David
 



Re: Java 8/Java 7 end of life

2015-03-10 Thread Mark Struberg
TomEE uses trunk builds.
2.3.x is not really used anymore.
Guess we should really establish a more feature driven release policy. 
Currently it is really product driven. This is fine for 2.2.x but I think this 
doesn’t scale well for future releases.

LieGrue,
strub


 Am 10.03.2015 um 14:40 schrieb Rick Curtis curti...@gmail.com:
 
 I don't think my previous comment was entirely correct.
 
 OpenJPA 2.3.x and trunk should be functional with java8, but I don't
 think you can build OpenJPA with java8.
 Java 8 works with 2.2.x and trunk. I can't say for certain about the 2.3.x
 branch... that is maintained by the TomEE folks and I can't recall which
 changes they did / didn't pull in to support Java 8.
 
 Thanks,
 Rick
 
 On Tue, Mar 10, 2015 at 3:31 AM, Henno Vermeulen he...@huizemolenaar.nl
 wrote:
 
 Hal Hildebrand wrote:
 I can certainly confirm that OpenJPA runs on java 8.  And even
 compiles when using source 1.7, target 1.7.
 
 Thank you Hal, that is some very useful information! It gives a solution
 to possible future security issues due to using an outdated VM.
 
 (I already tried using the released version 2.3.0 of OpenJPA with Java 8.
 Compiling works ok but enhancing the entities failed with some error
 message.)
 
 Henno
 
 
 -Oorspronkelijk bericht-
 Van: Rick Curtis [mailto:curti...@gmail.com]
 Verzonden: maandag 9 maart 2015 19:30
 Aan: users
 Onderwerp: Re: Java 8/Java 7 end of life
 
 Hal -
 
 What are you seeing for problems? We've done some amount of testing Entity
 enhancement when using java 8 language features.
 
 Thanks,
 Rick
 
 On Mon, Mar 9, 2015 at 10:46 AM, Hal Hildebrand hal.hildebr...@me.com
 wrote:
 
 No.
 
 On Mar 9, 2015, at 8:44 AM, Boblitz John john.bobl...@bertschi.com
 wrote:
 
 Hello,
 
 Does the Byte Code Enhancement work when compiled for 1.8?
 
 Thanks  Regards,
 
 John Boblitz
 
 
 -Original Message-
 From: Hal Hildebrand [mailto:hal.hildebr...@me.com]
 Sent: Montag, 9. März 2015 16:21
 To: users@openjpa.apache.org
 Subject: Re: Java 8/Java 7 end of life
 
 I can certainly confirm that OpenJPA runs on java 8.  And even
 compiles when using source 1.7, target 1.7.  Byte code enhancement
 works fine on
 the
 code when compiled in that fashion.
 
 On Mar 9, 2015, at 6:06 AM, Rick Curtis curti...@gmail.com wrote:
 
 OpenJPA 2.3.x and trunk should be functional with java8, but I
 don't think you can build OpenJPA with java8.
 
 On Mon, Mar 9, 2015 at 3:52 AM, Henno Vermeulen
 he...@huizemolenaar.nl
 wrote:
 
 Hello,
 
 AFAIK, OpenJPA still doesn't work with Java 8. Are there any
 plans of fixing this soon? Perhaps OpenJPA committers could give
 this some more priority?
 
 Oracle public support for Java 7 will end after April this year,
 see http://www.oracle.com/technetwork/java/javase/eol-135779.html
 If I understand well, this means that security issues in Oracle's
 Java 7 runtime will no longer be fixed so that an application
 using OpenJPA on Java 7 will become more and more vulnerable over
 time.
 
 The ticket for Java 8 was last updated in October 2014:
 https://issues.apache.org/jira/browse/OPENJPA-2386
 
 Regards,
 Henno Vermeulen
 
 
 
 
 --
 *Rick Curtis*
 
 
 
 
 
 --
 *Rick Curtis*
 
 
 
 
 -- 
 *Rick Curtis*



Re: Auditor issue after upgrading to OpenJPA 2.3.0

2013-12-05 Thread Mark Struberg
No worries. I am currently tweaking my slides for a 3 days workshop next week.
After that I have time to look at this stuff.

Reminds me that I still need to merge a few commits from 2.3.0 to trunk + ship 
the site build :/

LieGrue,
strub




- Original Message -
 From: Rick Curtis curti...@gmail.com
 To: users users@openjpa.apache.org
 Cc: Mark Struberg strub...@yahoo.de
 Sent: Thursday, 5 December 2013, 15:35
 Subject: Re: Auditor issue after upgrading to OpenJPA 2.3.0
 
 Mark --
 
 I'll also note that I'm having problems with the changes that were done 
 for
 OPENJPA-2437 with some internal tests. My test failures are different than
 Harald's though.
 
 It's a long story as to why the problem wasn't uncovered earlier but I 
 hope
 to get time to look at it later today or tomorrow.
 
 
 
 On Thu, Dec 5, 2013 at 8:16 AM, Harald Wellmann 
 hwellmann...@gmail.comwrote:
 
  Please see https://issues.apache.org/jira/browse/OPENJPA-2464. There's 
 a
  test case attached.
 
  Best regards,
  Harald
 
 
  2013/11/27 Mark Struberg strub...@yahoo.de
 
   This is not known, but we moved the invocation of the auditing 
 mechanism
   around a bit.
   There must be a JIRA which is tagged as 2.3.1.
  
   Please create a new JIRA for it and we will take a look.
  
   LieGrue,
   strub
  
  
  
   
From: Harald Wellmann hwellmann...@gmail.com
   To: users@openjpa.apache.org
   Sent: Wednesday, 27 November 2013, 15:52
   Subject: Auditor issue after upgrading to OpenJPA 2.3.0
   
   
   After upgrading from OpenJPA 2.2.2 to 2.3.0, one of my regression 
 tests
   fails since Auditor.audit() delivers too many objects. In 
 particular,
   after
   changing a given field from x to y, some of the updated objects 
 occur
   twice, with the surplus occurrence reporting the field as changed 
 from y
   to
   y.
   
   Is this a known issue?
   
   The changes affect an embeddable type which occurs twice in a 
 given
   entity:
   
   @Entity
   @Auditable
   public class Container {
   
      @AttributeOverrides(...)
      private Item leftItem;
   
      @AttributeOverrides(...)
      private Item rightItem;
   }
   
   @Embeddable
   @Auditable(values = { AuditableOperation.UPDATE })
   public class Item {
   }
   
   Best regards,
   Harald
   
   
   
  
 
 
 
 
 -- 
 *Rick Curtis*



Re: Auditor issue after upgrading to OpenJPA 2.3.0

2013-11-27 Thread Mark Struberg
This is not known, but we moved the invocation of the auditing mechanism around 
a bit.
There must be a JIRA which is tagged as 2.3.1.

Please create a new JIRA for it and we will take a look.

LieGrue,
strub




 From: Harald Wellmann hwellmann...@gmail.com
To: users@openjpa.apache.org 
Sent: Wednesday, 27 November 2013, 15:52
Subject: Auditor issue after upgrading to OpenJPA 2.3.0
 

After upgrading from OpenJPA 2.2.2 to 2.3.0, one of my regression tests
fails since Auditor.audit() delivers too many objects. In particular, after
changing a given field from x to y, some of the updated objects occur
twice, with the surplus occurrence reporting the field as changed from y to
y.

Is this a known issue?

The changes affect an embeddable type which occurs twice in a given entity:

@Entity
@Auditable
public class Container {

   @AttributeOverrides(...)
   private Item leftItem;

   @AttributeOverrides(...)
   private Item rightItem;
}

@Embeddable
@Auditable(values = { AuditableOperation.UPDATE })
public class Item {
}

Best regards,
Harald




AW: Re: OpenJPA 2.3.0-SNAPSHOT sources not available in maven

2013-11-19 Thread Mark Struberg

please note that trunk got moved to 2.0.4-SNAPSHOT.

LG,
strub




--
Albert Lee schrieb am Di., 19. Nov 2013 00:49 MEZ:

Nightly build can be found in
http://openjpa.apache.org/downloads-nightly.html

I followed the 
apache-openjpa-2.3.0-SNAPSHOT-source.ziphttps://repository.apache.org/snapshots/org/apache/openjpa/apache-openjpa/2.3.0-SNAPSHOT/link
and I was able to download

https://repository.apache.org/snapshots/org/apache/openjpa/apache-openjpa/2.3.0-SNAPSHOT/apache-openjpa-2.3.0-20131024.064931-148-source.ziphttps://repository.apache.org/content/groups/snapshots/org/apache/openjpa/apache-openjpa/2.3.0-SNAPSHOT/apache-openjpa-2.3.0-20131024.064931-148-source.zip



On Mon, Nov 18, 2013 at 4:06 PM, Reinis Vicups open...@orbit-x.de wrote:

 Hi,

 I see that openjpa-2.3.0-20131024.064931-148-sources.jar-not-available.

 Is there a way to somehow access and bind openjpa sources in maven?

 thx
 reinis




-- 
Albert Lee.



Re: Vote for standard JPA jar in maven

2013-11-15 Thread Mark Struberg
I was speaking about javax.* apis in general. 
JPA2.x are EPL, but JPA1 is CDDL, isn't?

In any case I prefer having our own IP clean spec jars.  It's just so much 
easier to not having to check the licenses each time.

LieGrue,
strub





 From: Rick Curtis curti...@gmail.com
To: users users@openjpa.apache.org; Mark Struberg strub...@yahoo.de 
Sent: Friday, 15 November 2013, 18:15
Subject: Re: Vote for standard JPA jar in maven
 


 CDDL is still not perfect and some apis are even LGPL (which is a complete 
no-go).


CDDL? I thought that the javax.persistence files are EPL?



On Fri, Nov 15, 2013 at 1:30 AM, Mark Struberg strub...@yahoo.de wrote:

The problem is usually not vendor neutrality but the license.
CDDL is still not perfect and some apis are even LGPL (which is a complete 
no-go).

Thus using our very own clean room engineered org.apache.geronimo.spec.* API 
jars is still the safest bet.

LieGrue,
strub





- Original Message -
 From: Matthew Adams matt...@matthewadams.me
 To: users@openjpa.apache.org; kundera-disc...@googlegroups.com
 Cc:
 Sent: Thursday, 14 November 2013, 17:47
 Subject: Vote for standard JPA jar in maven

 Please vote for this issue, requesting that a standard, vendor-neutral JPA
 jar be published.

 https://java.net/jira/browse/JPA_SPEC-60

 -matthew





-- 
Rick Curtis




Re: OpenJPA 2.3.0 Release

2013-10-04 Thread Mark Struberg


will try to find out what the underlying problem is.

LieGrue,
strub






 From: Rick Curtis curti...@gmail.com
To: users users@openjpa.apache.org 
Cc: Mark Struberg strub...@yahoo.de 
Sent: Friday, 4 October 2013, 16:24
Subject: Re: OpenJPA 2.3.0 Release
 

Mark -

I reopened OPENJPA-2171 yesterday as I think we need to get that
straightened out before we cut another release. Please take a look if you
get a chance.

Thanks,
Rick



On Wed, Oct 2, 2013 at 9:11 AM, Kevin Sutter kwsut...@gmail.com wrote:

 Hi Mark,
 My original proposal [1] was to cut this OpenJPA 2.3.0 release and then do
 JPA 2.1 in trunk.  Trunk would become 3.0.0-SNAPSHOT.  We do have an
 existing JPA 2.1 sandbox, but we would merge the work that Pinaki has done
 into trunk -- after we cut off the 2.3.0 release.  That would be the plan
 anyway.

 Kevin

 [1]

 http://openjpa.208410.n2.nabble.com/JPA-2-1-Development-Kickoff-td7584933.html


 On Wed, Oct 2, 2013 at 12:58 AM, Mark Struberg strub...@yahoo.de wrote:

  Well, actually the most important thing in this release is the ASM4 fix.
  I plan to do much more releases on a much tighter schedule. We should get
  out bugfixes much quicker imo.
 
  I suspect that JPA-2.1 work is done in a branch for now and will finally
  end up being a 3.0.x release, right?
  Just for me to understand how much work is done in which place...
 
  LieGrue,
  strub
 
 
 
 
  - Original Message -
   From: Kevin Sutter kwsut...@gmail.com
   To: users@openjpa.apache.org; Mark Struberg strub...@yahoo.de;
  d...@openjpa.apache.org
   Cc:
   Sent: Monday, 30 September 2013, 18:31
   Subject: Re: OpenJPA 2.3.0 Release
  
   I think we need to get this out to the dev community as well...  Have
 you
   done any triage on the existing JIRAs for any show-stoppers?
  
   Thanks,
   Kevin
  
  
   On Sat, Sep 28, 2013 at 7:22 AM, Mark Struberg strub...@yahoo.de
  wrote:
  
    I've now created the 2.3.x branch for preparing the release.
    If you find any showstoppers in trunk then please think about pinging
  me.
  
    LieGrue,
    strub
  
  
  
  
    - Original Message -
     From: Kevin Sutter kwsut...@gmail.com
     To: users@openjpa.apache.org; Mark Struberg strub...@yahoo.de
     Cc:
     Sent: Monday, 23 September 2013, 14:57
     Subject: Re: OpenJPA 2.3.0 Release
    
    T hanks, Mark.
    
     Here's a starting point for our release process:
     http://openjpa.apache.org/release-management.html
    
     The steps you are interested in are under the Apache Nexus Release
     process:
    
  
 
 http://openjpa.apache.org/apache-nexus-release-process-(1.2.x-2.1.x).html
    
     Good luck!  There are several people that have done Apache OpenJPA
    releases
     recently, so hopefully you'll get the assistance you need.  But, I
   do
    know
     at least one of them is busy with JavaOne this week...
    
     Kevin
    
    
     On Sun, Sep 22, 2013 at 9:33 AM, Mark Struberg
   strub...@yahoo.de
    wrote:
    
      I can kick off all the maven parts of the release.
    
      I'm not sure what else do we need in terms of readme and JISA
   release
      notes housekeeping?
      Is there a wiki page or any other documentation about it
   somewhere?
    
      From my experience as Release Manager in other Apache projects I
   would
      have the following tasks on my TODO list. And some of them need
    community
      involvement prior to starting the actual release process
    
      * go through all open JIRA issues which have 2.3 as target
   release.
    There
      might be some of them which already got released. Then do the
   same for
    all
      open issues which show no apparent target version.
      * Check all resolved issues and file them into release notes.
      * pick some low hanging fruits in terms of open tasks and resolve
   them
    if
      possible.
      * run the TCK. As the current 2.3.0-SNAPSHOT is daily run by the
   TomEE
      build, I assume this is already covered. Please not that while
   I'm JCP
      member, I have not yet filed any JPA TCK NDA. So I cannot check
   this
    myself
      * create a 2.3.x maintenance branch.
    
      Any other tasks prior to firing up mvn release:prepare?
    
    
      LieGrue,
      strub
    
    
    
    
      - Original Message -
       From: Kevin Sutter kwsut...@gmail.com
       To: users@openjpa.apache.org
       Cc:
       Sent: Saturday, 21 September 2013, 23:10
       Subject: Re: OpenJPA 2.3.0 Release
      
       Hi Matias,
       Yes, we have plans for a 2.3.0 release.  I just don't
   know the
     exact
      dates
       yet.  We need to cut a final major release for
   the JPA 2.0
     level of
       functionality before we kick off the JPA 2.1 development
   activities.
     I'm
       drafting a note to solicit for volunteers for this
   activity.  I would
      hope
       that this 2.3.0 release could be something that one of our
   committers

Re: OpenJPA 2.3.0 Release

2013-10-01 Thread Mark Struberg
Well, actually the most important thing in this release is the ASM4 fix.
I plan to do much more releases on a much tighter schedule. We should get out 
bugfixes much quicker imo.

I suspect that JPA-2.1 work is done in a branch for now and will finally end up 
being a 3.0.x release, right?
Just for me to understand how much work is done in which place...

LieGrue,
strub




- Original Message -
 From: Kevin Sutter kwsut...@gmail.com
 To: users@openjpa.apache.org; Mark Struberg strub...@yahoo.de; 
 d...@openjpa.apache.org
 Cc: 
 Sent: Monday, 30 September 2013, 18:31
 Subject: Re: OpenJPA 2.3.0 Release
 
 I think we need to get this out to the dev community as well...  Have you
 done any triage on the existing JIRAs for any show-stoppers?
 
 Thanks,
 Kevin
 
 
 On Sat, Sep 28, 2013 at 7:22 AM, Mark Struberg strub...@yahoo.de wrote:
 
  I've now created the 2.3.x branch for preparing the release.
  If you find any showstoppers in trunk then please think about pinging me.
 
  LieGrue,
  strub
 
 
 
 
  - Original Message -
   From: Kevin Sutter kwsut...@gmail.com
   To: users@openjpa.apache.org; Mark Struberg strub...@yahoo.de
   Cc:
   Sent: Monday, 23 September 2013, 14:57
   Subject: Re: OpenJPA 2.3.0 Release
  
  T hanks, Mark.
  
   Here's a starting point for our release process:
   http://openjpa.apache.org/release-management.html
  
   The steps you are interested in are under the Apache Nexus Release
   process:
  
  http://openjpa.apache.org/apache-nexus-release-process-(1.2.x-2.1.x).html
  
   Good luck!  There are several people that have done Apache OpenJPA
  releases
   recently, so hopefully you'll get the assistance you need.  But, I 
 do
  know
   at least one of them is busy with JavaOne this week...
  
   Kevin
  
  
   On Sun, Sep 22, 2013 at 9:33 AM, Mark Struberg 
 strub...@yahoo.de
  wrote:
  
    I can kick off all the maven parts of the release.
  
    I'm not sure what else do we need in terms of readme and JISA 
 release
    notes housekeeping?
    Is there a wiki page or any other documentation about it 
 somewhere?
  
    From my experience as Release Manager in other Apache projects I 
 would
    have the following tasks on my TODO list. And some of them need
  community
    involvement prior to starting the actual release process
  
    * go through all open JIRA issues which have 2.3 as target 
 release.
  There
    might be some of them which already got released. Then do the 
 same for
  all
    open issues which show no apparent target version.
    * Check all resolved issues and file them into release notes.
    * pick some low hanging fruits in terms of open tasks and resolve 
 them
  if
    possible.
    * run the TCK. As the current 2.3.0-SNAPSHOT is daily run by the 
 TomEE
    build, I assume this is already covered. Please not that while 
 I'm JCP
    member, I have not yet filed any JPA TCK NDA. So I cannot check 
 this
  myself
    * create a 2.3.x maintenance branch.
  
    Any other tasks prior to firing up mvn release:prepare?
  
  
    LieGrue,
    strub
  
  
  
  
    - Original Message -
     From: Kevin Sutter kwsut...@gmail.com
     To: users@openjpa.apache.org
     Cc:
     Sent: Saturday, 21 September 2013, 23:10
     Subject: Re: OpenJPA 2.3.0 Release
    
     Hi Matias,
     Yes, we have plans for a 2.3.0 release.  I just don't 
 know the
   exact
    dates
     yet.  We need to cut a final major release for 
 the JPA 2.0
   level of
     functionality before we kick off the JPA 2.1 development 
 activities.
   I'm
     drafting a note to solicit for volunteers for this 
 activity.  I would
    hope
     that this 2.3.0 release could be something that one of our 
 committers
    could
     pickup rather quickly...
    
     Kevin
    
    
     On Mon, Aug 26, 2013 at 1:12 PM, Matias G
     matias.gavinow...@gmail.comwrote:
    
      Hi,
    
      I was wondering if anyone knows whether the 2.3.0 is 
 planned and
   what
    would
      the expected timeframe for that? I am very interested 
 in the fix
   for
    one
      particular issue
   (https://issues.apache.org/jira/browse/OPENJPA-2318)
      which
      was solved just a few days ago.
    
      I upgraded to 2.3.0-SNAPSHOT and it works for me, but 
 would find
   it
    really
      helpful to know if there is a final release planned so 
 I can in
   turn
    plan
      in advance for how long I could expect to keep using 
 snapshot
   versions.
    
      I looked at previous release dates and found 
 they've happened
      February-November-April, so I don't know if the 
 next one
   would be
     happening
      this year. In my search through the site I could not 
 find info on
    future
      releases.
    
      If anyone can point me to the right 
 resource/person/information,
   many
      thanks.
    
      Matias
    
    
  
  
 



Re: OpenJPA 2.3.0 Release

2013-09-22 Thread Mark Struberg
I can kick off all the maven parts of the release. 

I'm not sure what else do we need in terms of readme and JISA release notes 
housekeeping?
Is there a wiki page or any other documentation about it somewhere?

From my experience as Release Manager in other Apache projects I would have the 
following tasks on my TODO list. And some of them need community involvement 
prior to starting the actual release process

* go through all open JIRA issues which have 2.3 as target release. There might 
be some of them which already got released. Then do the same for all open 
issues which show no apparent target version.
* Check all resolved issues and file them into release notes.
* pick some low hanging fruits in terms of open tasks and resolve them if 
possible.
* run the TCK. As the current 2.3.0-SNAPSHOT is daily run by the TomEE build, I 
assume this is already covered. Please not that while I'm JCP member, I have 
not yet filed any JPA TCK NDA. So I cannot check this myself
* create a 2.3.x maintenance branch.

Any other tasks prior to firing up mvn release:prepare?


LieGrue,
strub




- Original Message -
 From: Kevin Sutter kwsut...@gmail.com
 To: users@openjpa.apache.org
 Cc: 
 Sent: Saturday, 21 September 2013, 23:10
 Subject: Re: OpenJPA 2.3.0 Release
 
 Hi Matias,
 Yes, we have plans for a 2.3.0 release.  I just don't know the exact dates
 yet.  We need to cut a final major release for the JPA 2.0 level of
 functionality before we kick off the JPA 2.1 development activities.  I'm
 drafting a note to solicit for volunteers for this activity.  I would hope
 that this 2.3.0 release could be something that one of our committers could
 pickup rather quickly...
 
 Kevin
 
 
 On Mon, Aug 26, 2013 at 1:12 PM, Matias G 
 matias.gavinow...@gmail.comwrote:
 
  Hi,
 
  I was wondering if anyone knows whether the 2.3.0 is planned and what would
  the expected timeframe for that? I am very interested in the fix for one
  particular issue (https://issues.apache.org/jira/browse/OPENJPA-2318)
  which
  was solved just a few days ago.
 
  I upgraded to 2.3.0-SNAPSHOT and it works for me, but would find it really
  helpful to know if there is a final release planned so I can in turn plan
  in advance for how long I could expect to keep using snapshot versions.
 
  I looked at previous release dates and found they've happened
  February-November-April, so I don't know if the next one would be 
 happening
  this year. In my search through the site I could not find info on future
  releases.
 
  If anyone can point me to the right resource/person/information, many
  thanks.
 
  Matias
 



Re: Why is parent version incremented on update of child entity?

2012-12-10 Thread Mark Struberg
This happens most times if you have Cascade.PERSIST enabled. This makes your 
1:n list a 'part' of your 'main entity'. The idea is that once you change a 
part of your logical area you need to prevent concurring changes on the whole 
area. Otherwise consistency cannot get guaranteed. Thus a touch on the 'main 
entity' gets performed to ensure an OptimisticLockingException in case someone 
else tries to change the 'logic area' at the same time. 

Think about a Customer with 1:n Address entries. Imagine what would happen if 2 
independent users would add the same address? This would not result in a db 
constraint error but still the logical consistency of the Customer entry would 
be broken! By touching the parent entity this can be detected and would lead to 
optimistic locking.

LieGrue,
strub




- Original Message -
 From: mwalter marc.wal...@sbb.ch
 To: users@openjpa.apache.org
 Cc: 
 Sent: Monday, December 10, 2012 4:40 PM
 Subject: Why is parent version incremented on update of child entity?
 
 I found out that on update of a child entity the parent version field is
 incremented as well. Is this default behaviour? Is it possible to change the
 increment strategy somehow so that the parent version does not change?
 
 I'm using OpenJPA 1.2.3 (WebSphere V7), LockManager is set to 
 version.
 
 Thanks for any help and/or explanation!
 
 
 
 --
 View this message in context: 
 http://openjpa.208410.n2.nabble.com/Why-is-parent-version-incremented-on-update-of-child-entity-tp7582115.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.
 


Re: maven-openjpa-plugin ClassLoader issues?

2012-09-04 Thread Mark Struberg
No, this works perfectly over here. You do not need to add any dependency at 
all!
The only stuff I had to add is cobertura if you use code coverage reporting. 
The reason is that cobertura enhances the classes with it's own interceptors 
and openjpa fails to enhance if it cannot find those classes.

LieGrue,
strub




- Original Message -
 From: andyatmiami stone...@gmail.com
 To: users@openjpa.apache.org
 Cc: 
 Sent: Thursday, August 30, 2012 7:46 PM
 Subject: Re: maven-openjpa-plugin ClassLoader issues?
 
 I guess my issue is that behavior is NOT happening - the compile classpath is
 NOT being added to the plugin - and I have to manually add all dependencies.
 
 Has anyone heard of this happening?
 
 
 
 --
 View this message in context: 
 http://openjpa.208410.n2.nabble.com/maven-openjpa-plugin-ClassLoader-issues-tp7580984p7580987.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.
 


Re: maven-openjpa-plugin ClassLoader issues?

2012-08-30 Thread Mark Struberg
Hi Andy!

the openjpa-maven-plugin does automatically add the compile classpath if you 
use openjpa:enhance and the test-compile classpath if you use 
openjpa:test-enhance.

And your attachments got eaten by the spam filter it seems ;)

LieGrue,
strub




- Original Message -
 From: andyatmiami stone...@gmail.com
 To: users@openjpa.apache.org
 Cc: 
 Sent: Thursday, August 30, 2012 4:40 PM
 Subject: maven-openjpa-plugin ClassLoader issues?
 
G reetings,
 
 I am using the maven-openjpa-plugin:2.2.0 from apache (NOT the mojo plugin -
 not sure if that matters).
 
 The problem I am seeing is that it seems I have to manually list any
 dependencies my code relies upon in the plugin when I am calling the  goal
 on the plugin.  The  property states: If you enable this feature, then no
 depending artifacts from the classpath will be used!.  That certainly 
 seems
 like the behavior I am seeing...but the default value of that property is
 false. 
 
 Any thoughts on what about my configuration is causing me issues?
 
 Thanks!
 Andy
 
 *** Environment/Config info below ***
 
 
 My Maven/JDK info is as follows:
 
 
 
 My plugin configuration is:
 
 
 
 
 
 --
 View this message in context: 
 http://openjpa.208410.n2.nabble.com/maven-openjpa-plugin-ClassLoader-issues-tp7580984.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Annotations removed when enhancing?

2012-08-08 Thread Mark Struberg


Kevin is right. I re-checked it now as well. At least for build-time enhanced 
entities the annotations remain on the class and fields. We do not use method 
annotations, so I cannot check this quickly. 

What confused me earlier is that jad (java decompiler) doesn't seem to show 
annotations in general. But looking at the hex dump of the class file itself 
clearly shows that they are there.

What way of enhancement do you use in your project?
If you use subclassing, then the generated subclass is probably without 
annotations.


LieGrue,
strub



- Original Message -
 From: Kevin Sutter kwsut...@gmail.com
 To: users@openjpa.apache.org
 Cc: 
 Sent: Tuesday, August 7, 2012 5:21 PM
 Subject: Re: Annotations removed when enhancing?
 
 I'm curious why you think that the annotations are removed...  Even after
 enhancement is performed, OpenJPA parses the entity classes to get the ORM
 data, which is normally specified via annotations.  Do you have an example?
 
 Kevin
 
 On Sun, Aug 5, 2012 at 1:09 PM, Chris Joysn joys...@gmail.com wrote:
 
  well.. unfortunately a framework relies on it to detect JPA entities... i
  think there is no other way to detect in a reliable way JPA entities?
 
  LieGrueZuRue
 
 
  On 5 August 2012 19:52, Mark Struberg strub...@yahoo.de wrote:
 
   Having code relying on @Entity is bitter so to say ;)
  
   All JPA functions could also be added via XML, without having any
   annotation on your entities...
  
   Such code would btw also not work in Hibernate if you use proxies.
  Becasue
   the generated proxies don't have annotations neither.
  
   LieGrue,
   strub
  
  
  
   - Original Message -
From: Chris Joysn joys...@gmail.com
To: users@openjpa.apache.org
Cc:
Sent: Sunday, August 5, 2012 7:19 PM
Subject: Annotations removed when enhancing?
   
Hello,
   
is it possible that entities do not get their annotations removed 
 when
OpenJPA is performing its enhancements?
   
unfortunately some code relies on the fact that eg. @Entity is 
 present
  on
classes, but this annotation gets removed by OpenJPA.
   
thanks
   
  
 



Re: Annotations removed when enhancing?

2012-08-08 Thread Mark Struberg
yikes, that means you use subclassing. 


I recommend to use the openjpa-maven-plugin to enhance the classes at build 
time already.

Here is a sample which you can look at

https://github.com/struberg/lightweightEE/blob/master/backend-api/pom.xml

We still need to polish our own documentation, but the parameters are almost 
the same as in the old version which you can find at [1].
The openjpa-maven-plugin is not part of OpenJPA itself since 2.2.0.


LieGrue,
strub

[1] http://mojo.codehaus.org/openjpa-maven-plugin/usage.html



- Original Message -
 From: Chris Joysn joys...@gmail.com
 To: users@openjpa.apache.org
 Cc: 
 Sent: Wednesday, August 8, 2012 7:04 PM
 Subject: Re: Annotations removed when enhancing?
 
 well... i am not so an experienced OpenJPA user but i can provide the
 following information:
 
 before merging the entity to an persistence context the class of the entity
 looks like:
 
 org.activiti.standalone.jpa.FieldAccessJPAEntity@4260ab
 
 after the merge it looks like:
 
 org.apache.openjpa.enhance.org
 $activiti$standalone$jpa$FieldAccessJPAEntity$pcsubclass@df88d2
 
 when performing an
 
 private boolean isEntityAnnotationPresent(Class? clazz) {
     return (clazz.getAnnotation(Entity.class) != null);
 }
 
 the Entity.class annotation is found before the merge, not not after the
 merge.
 
 And when subclassing is bad, how can i get rid of it?
 
 Chris
 
 On 8 August 2012 15:55, Kevin Sutter kwsut...@gmail.com wrote:
 
    What way of enhancement do you use in your project?
    If you use subclassing, then the generated subclass is probably 
 without
  annotations.
 
  And, if you are using subclassing, then quit using subclassing!  :-)
  Nobody that is serious about their application should be using subclassing
  support.  I've even been throwing around the idea of removing the
  subclassing support altogether since it can cause more issues than it
  resolves...  But, that's a whole separate discussion...
 
  Kevin
 
  On Wed, Aug 8, 2012 at 1:13 AM, Mark Struberg strub...@yahoo.de 
 wrote:
 
  
  
   Kevin is right. I re-checked it now as well. At least for build-time
   enhanced entities the annotations remain on the class and fields. We 
 do
  not
   use method annotations, so I cannot check this quickly.
  
   What confused me earlier is that jad (java decompiler) doesn't 
 seem to
   show annotations in general. But looking at the hex dump of the class
  file
   itself clearly shows that they are there.
  
   What way of enhancement do you use in your project?
   If you use subclassing, then the generated subclass is probably 
 without
   annotations.
  
  
   LieGrue,
   strub
  
  
  
   - Original Message -
From: Kevin Sutter kwsut...@gmail.com
To: users@openjpa.apache.org
Cc:
Sent: Tuesday, August 7, 2012 5:21 PM
Subject: Re: Annotations removed when enhancing?
   
I'm curious why you think that the annotations are 
 removed...  Even
  after
enhancement is performed, OpenJPA parses the entity classes to 
 get the
   ORM
data, which is normally specified via annotations.  Do you have 
 an
   example?
   
Kevin
   
On Sun, Aug 5, 2012 at 1:09 PM, Chris Joysn 
 joys...@gmail.com wrote:
   
     well.. unfortunately a framework relies on it to detect JPA
   entities... i
     think there is no other way to detect in a reliable way JPA 
 entities?
   
     LieGrueZuRue
   
   
     On 5 August 2012 19:52, Mark Struberg 
 strub...@yahoo.de wrote:
   
      Having code relying on @Entity is bitter so to say ;)
     
      All JPA functions could also be added via XML, without 
 having any
      annotation on your entities...
     
      Such code would btw also not work in Hibernate if you 
 use proxies.
     Becasue
      the generated proxies don't have annotations 
 neither.
     
      LieGrue,
      strub
     
     
     
      - Original Message -
       From: Chris Joysn joys...@gmail.com
       To: users@openjpa.apache.org
       Cc:
       Sent: Sunday, August 5, 2012 7:19 PM
       Subject: Annotations removed when enhancing?
      
       Hello,
      
       is it possible that entities do not get their 
 annotations removed
when
       OpenJPA is performing its enhancements?
      
       unfortunately some code relies on the fact that 
 eg. @Entity is
present
     on
       classes, but this annotation gets removed by 
 OpenJPA.
      
       thanks
      
     
   
   
  
 



Re: Annotations removed when enhancing?

2012-08-08 Thread Mark Struberg
for test classes there is an own test-enhance goal

LieGrue,
strub



- Original Message -
 From: Chris Joysn joys...@gmail.com
 To: users@openjpa.apache.org; Mark Struberg strub...@yahoo.de
 Cc: 
 Sent: Wednesday, August 8, 2012 9:57 PM
 Subject: Re: Annotations removed when enhancing?
 
 nice :)
 
 thanks for your hints. But i seem unable to apply the plugin cfg to my
 setup successfully:
 
 i added the following cfg, changing the execution phase to
 process-test-classes, as the
 enhencement is only needed for entities needed in unit tests:
 
 plugin
     groupIdorg.codehaus.mojo/groupId
     artifactIdopenjpa-maven-plugin/artifactId
     version1.2/version
     configuration
       includesorg/activiti/standalone/jpa/*.class/includes
       addDefaultConstructortrue/addDefaultConstructor
       
 enforcePropertyRestrictionstrue/enforcePropertyRestrictions
 
 persistenceXmlFilesrc/test/resources/META-INF/persistence.xml/persistenceXmlFile
     /configuration
     executions
       execution
         idenhancer/id
         phaseprocess-test-classes/phase
         goals
           goalenhance/goal
         /goals
       /execution
     /executions
     dependencies
       dependency
         groupIdorg.apache.openjpa/groupId
         artifactIdopenjpa/artifactId
         version2.0.1/version
       /dependency
     /dependencies
   /plugin
 
 the plugin is unable to find the entities listed in the persistence.xml:
 
 [INFO] --- openjpa-maven-plugin:1.2:enhance (enhancer) @ activiti-engine ---
 38  activiti-jpa-pu  INFO   [main] openjpa.Tool - No targets were given.
 Running on all classes in your persistent classes list, or all metadata
 files in classpath directories if you have not listed your persistent
 classes.  Use -help to display tool usage information.
 [INFO]
 
 [INFO] BUILD FAILURE
 [INFO]
 
 [INFO] Total time: 3.623s
 [INFO] Finished at: Wed Aug 08 21:52:30 CEST 2012
 [INFO] Final Memory: 15M/250M
 [INFO]
 
 [ERROR] Failed to execute goal
 org.codehaus.mojo:openjpa-maven-plugin:1.2:enhance (enhancer) on project
 activiti-engine: Execution enhancer of goal
 org.codehaus.mojo:openjpa-maven-plugin:1.2:enhance failed:
 java.lang.ClassNotFoundException:
 org.activiti.standalone.jpa.IntegerIdJPAEntity - [Help 1]
 
 what i am missing for that plugin?
 
 Thanks
 Chris
 
 On 8 August 2012 20:22, Mark Struberg strub...@yahoo.de wrote:
 
  yikes, that means you use subclassing.
 
 
  I recommend to use the openjpa-maven-plugin to enhance the classes at
  build time already.
 
  Here is a sample which you can look at
 
  https://github.com/struberg/lightweightEE/blob/master/backend-api/pom.xml
 
  We still need to polish our own documentation, but the parameters are
  almost the same as in the old version which you can find at [1].
  The openjpa-maven-plugin is not part of OpenJPA itself since 2.2.0.
 
 
  LieGrue,
  strub
 
  [1] http://mojo.codehaus.org/openjpa-maven-plugin/usage.html
 
 
 
  - Original Message -
   From: Chris Joysn joys...@gmail.com
   To: users@openjpa.apache.org
   Cc:
   Sent: Wednesday, August 8, 2012 7:04 PM
   Subject: Re: Annotations removed when enhancing?
  
   well... i am not so an experienced OpenJPA user but i can provide the
   following information:
  
   before merging the entity to an persistence context the class of the
  entity
   looks like:
  
   org.activiti.standalone.jpa.FieldAccessJPAEntity@4260ab
  
   after the merge it looks like:
  
   org.apache.openjpa.enhance.org
   $activiti$standalone$jpa$FieldAccessJPAEntity$pcsubclass@df88d2
  
   when performing an
  
   private boolean isEntityAnnotationPresent(Class? clazz) {
       return (clazz.getAnnotation(Entity.class) != null);
   }
  
   the Entity.class annotation is found before the merge, not not after 
 the
   merge.
  
   And when subclassing is bad, how can i get rid of it?
  
   Chris
  
   On 8 August 2012 15:55, Kevin Sutter kwsut...@gmail.com wrote:
  
      What way of enhancement do you use in your project?
      If you use subclassing, then the generated subclass is 
 probably
   without
    annotations.
  
    And, if you are using subclassing, then quit using subclassing!  
 :-)
    Nobody that is serious about their application should be using
  subclassing
    support.  I've even been throwing around the idea of removing 
 the
    subclassing support altogether since it can cause more issues 
 than it
    resolves...  But, that's a whole separate discussion...
  
    Kevin
  
    On Wed, Aug 8, 2012 at 1:13 AM, Mark Struberg 
 strub...@yahoo.de
   wrote:
  
    
    
     Kevin is right. I re-checked it now as well. At least for 
 build-time
     enhanced entities the annotations remain on the class and 
 fields. We
   do
    not
     use method annotations, so

Re: Annotations removed when enhancing?

2012-08-05 Thread Mark Struberg
Having code relying on @Entity is bitter so to say ;)

All JPA functions could also be added via XML, without having any annotation on 
your entities...

Such code would btw also not work in Hibernate if you use proxies. Becasue the 
generated proxies don't have annotations neither.

LieGrue,
strub



- Original Message -
 From: Chris Joysn joys...@gmail.com
 To: users@openjpa.apache.org
 Cc: 
 Sent: Sunday, August 5, 2012 7:19 PM
 Subject: Annotations removed when enhancing?
 
 Hello,
 
 is it possible that entities do not get their annotations removed when
 OpenJPA is performing its enhancements?
 
 unfortunately some code relies on the fact that eg. @Entity is present on
 classes, but this annotation gets removed by OpenJPA.
 
 thanks
 


Re: OpenJPA enhancer or load-time weaver was not run..

2012-06-21 Thread Mark Struberg
Hi!

You can use OpenJPAs openjpa-maven-plugin for doing build-time enhancement.
As I think WAS-6.1 comes with a OpenJPA version prior to 2.2.0, you would need 
to use the 'old' plugin we hacked and hosted on codehaus:

http://mojo.codehaus.org/openjpa-maven-plugin/

From openjpa-2.2.0 on this is not provided as part of OpenJPA itself.
We finally need to improve the docs for it, but here is a sample about it's 
usage:
https://github.com/struberg/lightweightEE/blob/master/backend-api/pom.xml

LieGrue,
strub



- Original Message -
 From: pbt123 prabh...@in.ibm.com
 To: users@openjpa.apache.org
 Cc: 
 Sent: Thursday, June 21, 2012 8:08 PM
 Subject: OpenJPA enhancer or load-time weaver was not run..
 
 
 Hello Team,
 
 There a strange situation while running my web application on WAS 6.1
 
 The problem is : on local runtime WAS 6.1 (BASE 6.1.0.37 cf371109.05) 
 OpenJPA Enhancement is working at runtime  but on WAS6.1 (ND 
 6.1.0.19
 cf190836.04)  on AIX , runtime Enhancement is not working.
 
 Same WAR is working fine on WAS 6.1 (BASE 6.1.0.37 cf371109.05) WindowsXP
 but not working on WAS6.1 (ND 6.1.0.19 cf190836.04)  on AIX.
 
 error message:  Could not locate metadata for the class using alias
 UserHasRole. This could mean that the OpenJPA enhancer or load-time 
 weaver
 was not run on the type whose alias is UserHasRole. Registered alias
 mappings: {UserHasRole=null}
 
 Thanks in advance. 
 
 --
 View this message in context: 
 http://openjpa.208410.n2.nabble.com/OpenJPA-enhancer-or-load-time-weaver-was-not-run-tp7580368.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: OpenJPA vs EclipseLink

2012-05-09 Thread Mark Struberg
Here we go:

http://struberg.wordpress.com/2012/05/10/using-jpa-in-real-projects-part-1/

This just covers the project setup for now. But already contains a few neat 
tricks.

I'll continue to work on the 2nd part collecting and outlining some concept 
issues and workaround options for the programming model in your apps.

LieGrue,
strub



- Original Message -
 From: José Luis Cetina maxtorz...@gmail.com
 To: users@openjpa.apache.org; Mark Struberg strub...@yahoo.de
 Cc: 
 Sent: Friday, May 4, 2012 4:58 PM
 Subject: Re: OpenJPA vs EclipseLink
 
T hanks Mark, I'll be pendent for your post012/5/4 Mark Struberg 
 strub...@yahoo.de
 
  Another such 'JPA performance test'I've seen was one using an 
 Oracle
  database.
 
  The funny thing was that it did NOT use any additional SQL other than the
  generated one.
 
  Which means that ALL foreign key relations didn't have an Index set up!
  (Contrary to MySQL, Oracle doesn't automatically create indices for 
 foreign
  keys by default)
 
  I'm not sure what I should think about a guy who is doing a 
 'serious'
  performance test without even getting the DB indexes setup correctly ;)
 
  I'll currently working on a blog article which describes how to make 
 use
  of the openjpa-maven-plugin and sql-maven-plugin to efficiently handle
  databases in big applications. Not sure if I get it done before I travel to
  confess-2012 on sunday. Will keep you updated.
 
 
  LieGrue,
  strub
 
 
 
  - Original Message -
   From: Matthew Adams matt...@matthewadams.me
   To: users@openjpa.apache.org
   Cc:
   Sent: Friday, May 4, 2012 4:27 PM
   Subject: Re: OpenJPA vs EclipseLink
  
   ...or tests without your data...
  
   On Thu, May 3, 2012 at 4:28 PM, Mark Struberg 
 strub...@yahoo.de wrote:
  
  
  
    or tests without any jdbc pool ;)
  
    LieGrue,
    strub
  
  
  
    
     From: afryer apfr...@hotmail.com
    To: users@openjpa.apache.org
    Sent: Thursday, May 3, 2012 11:27 PM
    Subject: Re: OpenJPA vs EclipseLink
    
    One thing to be aware of is if you see performance 
 comparisons on the
    internet, make sure you know if the OpenJPA results are using 
 openjpa
    enhanced classes or not.  I've seen some very misleading 
 stats
   comparing
    OpenJPA to other ORMs using non-enhanced classes.
    
    --
    View this message in context:
  
  
 
 http://openjpa.208410.n2.nabble.com/OpenJPA-vs-EclipseLink-tp7521217p7525247.html
    Sent from the OpenJPA Users mailing list archive at 
 Nabble.com.
    
    
    
  
  
  
  
   --
   @matthewadams12
   mailto:matt...@matthewadams.me
   skype:matthewadams12
   yahoo:matthewadams
   aol:matthewadams12
   google-talk:matthewadam...@gmail.com
   msn:matt...@matthewadams.me
   http://matthewadams.me
   http://www.linkedin.com/in/matthewadams
  
 
 
 
 
 -- 
 ---
 *SCJA. José Luis Cetina*
 ---



Re: OpenJPA vs EclipseLink

2012-05-04 Thread Mark Struberg
Another such 'JPA performance test'I've seen was one using an Oracle database.

The funny thing was that it did NOT use any additional SQL other than the 
generated one.

Which means that ALL foreign key relations didn't have an Index set up! 
(Contrary to MySQL, Oracle doesn't automatically create indices for foreign 
keys by default)

I'm not sure what I should think about a guy who is doing a 'serious' 
performance test without even getting the DB indexes setup correctly ;)

I'll currently working on a blog article which describes how to make use of the 
openjpa-maven-plugin and sql-maven-plugin to efficiently handle databases in 
big applications. Not sure if I get it done before I travel to confess-2012 on 
sunday. Will keep you updated.


LieGrue,
strub



- Original Message -
 From: Matthew Adams matt...@matthewadams.me
 To: users@openjpa.apache.org
 Cc: 
 Sent: Friday, May 4, 2012 4:27 PM
 Subject: Re: OpenJPA vs EclipseLink
 
 ...or tests without your data...
 
 On Thu, May 3, 2012 at 4:28 PM, Mark Struberg strub...@yahoo.de wrote:
 
 
 
  or tests without any jdbc pool ;)
 
  LieGrue,
  strub
 
 
 
  
   From: afryer apfr...@hotmail.com
  To: users@openjpa.apache.org
  Sent: Thursday, May 3, 2012 11:27 PM
  Subject: Re: OpenJPA vs EclipseLink
  
  One thing to be aware of is if you see performance comparisons on the
  internet, make sure you know if the OpenJPA results are using openjpa
  enhanced classes or not.  I've seen some very misleading stats 
 comparing
  OpenJPA to other ORMs using non-enhanced classes.
  
  --
  View this message in context:
 
 http://openjpa.208410.n2.nabble.com/OpenJPA-vs-EclipseLink-tp7521217p7525247.html
  Sent from the OpenJPA Users mailing list archive at Nabble.com.
  
  
  
 
 
 
 
 -- 
 @matthewadams12
 mailto:matt...@matthewadams.me
 skype:matthewadams12
 yahoo:matthewadams
 aol:matthewadams12
 google-talk:matthewadam...@gmail.com
 msn:matt...@matthewadams.me
 http://matthewadams.me
 http://www.linkedin.com/in/matthewadams



Re: OpenJPA vs EclipseLink

2012-05-03 Thread Mark Struberg
Hi Andrew!

When I did my first evaluations for a new project 3 years ago. Back then I was 
checking out the sources fo EclipseLink, Hibernate and OpenJPA.

EclipseLink just didn't cut it at all. From what I've heard, the Eclipse 
community now rewrote a huge part of the code already, but they are imo still 
quite a few miles away from being production ready. I have honestly no idea how 
it could have become the RI for JPA...

Hibernate is much better. It basically works pretty well and is also relatively 
fast. There is only one thing which I don't like that much and this is their 
subclassing approach for 'enhancement'. This has a few nasty side effects and 
you need to know them.

I finally picked OpenJPA because it was (in my tests) the only JPA provider 
which was able to reliably serialize/deserialize entities without loosing state 
or trashing the database afterwards. I really need this because we have a real 
cluster environment and peak 5 mio page hits/day in our app, so not being able 
to serialize is a knock out. Of course you need a few magic properties in your 
persistence.xml:

property name=openjpa.DetachState value=loaded(DetachedStateField=true)/
property name=openjpa.Compatibility 
value=IgnoreDetachedStateFieldForProxySerialization=true/

The problem with the other JPA providers was the following scenario: 

1.) load from db
2.) change
3.) serialize (store in JSF @ViewScoped and wait for 2nd request)
4.) deserialize 

5.) change in the JSF applyValues phase

6.) merge in a JSF action


if you could change 5 and 6 then the other providers work as well. Too bad that 
doesn't fit the JSF workflow!
OpenJPA accomplishes this by _still_ using a StateManager, even if the entity 
is detached. 


In EclipseLink this didn't work at all.

In Hibernate it will work if you do _not_ use any Lazy Loading. Maybe that's 
the reason why HIbernate in the default modeeven ignores FetchType.LAZY in the 
top layer of your entity and always does eager fetching.




LieGrue,
strub


PS: I'm using build-time-enhancement with the openjpa-maven-plugin



- Original Message -
 From: Andrew Hastie and...@ahastie.net
 To: users@openjpa.apache.org
 Cc: 
 Sent: Wednesday, May 2, 2012 8:56 PM
 Subject: Re: OpenJPA vs EclipseLink
 
 For information, OpenJPA it is also embedded with IBM WebSphere.
 
 On 02/05/12 19:25, José Luis Cetina wrote:
  Hi im newbie in OpenJPA i know OpenJPA is an implementation as EclipseLink,
  i always used EclipseLink, now im moving from Glassfish to TomEE and i see
  openjpa is embeded with TomEE, i read the OpenJPA manual and i like the
  innovations in openjpa, but i just want to know the
  advantages/disadvantages of openjpa, or a little comparative with openjpa
  vs eclipselink or hibernate, and one more thing about how fast is openjpa
  vs others.
 



Re: OpenJPA vs EclipseLink

2012-05-03 Thread Mark Struberg


or tests without any jdbc pool ;)

LieGrue,
strub




 From: afryer apfr...@hotmail.com
To: users@openjpa.apache.org 
Sent: Thursday, May 3, 2012 11:27 PM
Subject: Re: OpenJPA vs EclipseLink
 
One thing to be aware of is if you see performance comparisons on the
internet, make sure you know if the OpenJPA results are using openjpa
enhanced classes or not.  I've seen some very misleading stats comparing
OpenJPA to other ORMs using non-enhanced classes.

--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-vs-EclipseLink-tp7521217p7525247.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.





Re: Metamodel generation with Maven

2012-04-30 Thread Mark Struberg
good read, already retweeted it ;)

LieGrue,
strub



- Original Message -
 From: Harald Wellmann hwellmann...@googlemail.com
 To: users@openjpa.apache.org
 Cc: 
 Sent: Monday, April 30, 2012 7:26 PM
 Subject: Metamodel generation with Maven
 
 Just for the record, metamodel generation with Maven has a couple of gotchas 
 - 
 mostly due to Maven, not to OpenJPA ;-)
 
 I wrote up my experience in [1] - maybe this is useful to other OpenJPA users.
 
 [1] 
 http://hwellmann.blogspot.de/2012/04/metamodel-classes-for-openjpa-with.html
 
 Best regards,
 Harald
 


Re: Using 2.2.0-SNAPSHOT maven plugin

2012-01-13 Thread Mark Struberg
Hi Francesco!

If you use the openjpa-maven-plugin from OpenJPA itself then you don't need to 
add any dependency!

The new one uses openjpa-kernel, etc directly and not the 1-in-all openjpa 
(-all) bundle anymore.
Please try to remove the openjpa dependency as a first step.


ad logging:

There are 2 mechanism included
  a.) openjpa loggin
  b.) the plugin logging from maven

If running Apache Maven with the -X option (mvn -X openjpa enhance) changes the 
log output, then you most probably hit b.).


For running the PCEnhancer from inside the maven plugin we have the plugin 
classpath (thus also its dependencies) plus the compile classpath (this is 
needed for the enhancer). So any jar in your dependencies section of the 
openjpa-m-p should get picked up as well.

hope that gives you a bit more info to continue your research - hope that helps.

LieGrue,
strub



- Original Message -
 From: Francesco Chicchiriccò ilgro...@apache.org
 To: users@openjpa.apache.org
 Cc: 
 Sent: Friday, January 13, 2012 2:08 PM
 Subject: Using 2.2.0-SNAPSHOT maven plugin
 
 Hi all,
 I am currently using OpenJPA 2.2.0-SNAPSHOT, so plugin is configured as
 follows:
 
             plugin
                 groupIdorg.apache.openjpa/groupId
                 artifactIdopenjpa-maven-plugin/artifactId
                 version2.2.0-SNAPSHOT/version
                 dependencies
                     dependency
                         groupIdorg.apache.openjpa/groupId
                         artifactIdopenjpa/artifactId
                         version2.2.0-SNAPSHOT/version
                     /dependency
                     dependency
                         groupIdcom.h2database/groupId
                         artifactIdh2/artifactId
                         version${h2.version}/version
                     /dependency
                 /dependencies
                 configuration
                   
 includesorg/syncope/core/persistence/beans/**/*.class/includes
                   
 connectionDriverNameorg.springframework.jdbc.datasource.DriverManagerDataSource/connectionDriverName
                     connectionProperties
                         driverClassName=org.h2.Driver,
                         url=jdbc:h2:mem:syncopedb
                         username=sa,
                         password=
                     /connectionProperties
                 /configuration
                 executions
                     execution
                         idenhancer/id
                         phaseprocess-classes/phase
                         goals
                             goalenhance/goal
                         /goals
                     /execution
                 /executions
             /plugin
 
 It works fine either with openjpa:enhance and openjpa:sql but it shows
 some warnings:
 
 [INFO] --- openjpa-maven-plugin:2.2.0-SNAPSHOT:enhance (enhancer) @
 syncope-core ---
 Downloading:
 file://${basedir}/internal-repository/org/apache/openjpa/openjpa-lib/2.2.0-SNAPSHOT/maven-metadata.xml
 [WARNING] Could not transfer metadata
 org.apache.openjpa:openjpa-lib:2.2.0-SNAPSHOT/maven-metadata.xml from/to
 openjpa-internal (file://${basedir}/internal-repository): Repository
 path /internal-repository does not exist, and cannot be created.
 
 Moreover, I'd like to redirect these log messages somewhere; as far as
 I've understood, it should be enough to include logback in plugin's
 classpath:
 
 SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder.
 SLF4J: Defaulting to no-operation (NOP) logger implementation
 SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for
 further details.
 
 but adding it as bare dependency in the configuration above does not 
 work.
 
 Any hint?
 
 -- 
 Francesco Chicchiriccò
 
 Apache Cocoon Committer and PMC Member
 http://people.apache.org/~ilgrosso/



Re: ANN: OpenJPA Intellij plugin

2012-01-08 Thread Mark Struberg
Hi!

Best is to post your questions to the dev@openjpa.a.o list.
We will be happy to provide help as good as we can :)

We are sometimes also available on irc.freenode.net channel #openjpa


LieGrue,
strub



- Original Message -
 From: machak m.milice...@onehippo.com
 To: users@openjpa.apache.org
 Cc: 
 Sent: Sunday, January 8, 2012 8:27 PM
 Subject: Re: ANN: OpenJPA Intellij plugin
 
 Hi, 
 how can I contact Mark/Donald. I checked OpenJpa site but there are no email
 addresses mentioned,
 tia,
 cheers
 marijan



Re: PCEnhancer / PCEnhancerTask should take in class path

2011-12-27 Thread Mark Struberg
are you still using ant or already using maven?

If you use maven, then have a look at the openjpa-maven-plugin [1].

LieGrue,
strub

[1] http://openjpa.apache.org/enhancement-with-maven.html
Please note that we need to tweak this section a bit. The dependency to openjpa 
itself is not needed anymore if you use the org.apache.openjpa version of the 
plugin.



- Original Message -
 From: Pawel Veselov pawel.vese...@gmail.com
 To: users@openjpa.apache.org
 Cc: 
 Sent: Tuesday, December 27, 2011 4:56 AM
 Subject: PCEnhancer / PCEnhancerTask should take in class path
 
 Hi.
 
 after bashing my head for awhile against the PCEnhancer, it looks like it
 really needs a way to take in the class path where to work with entities
 instead of relying on current class path. The problem is with a simple task:
 
 target name=openjpa.enhance
   taskdef
     name=openjpac
     classname=org.apache.openjpa.ant.PCEnhancerTask
     classpathref=war.classpath
   /
 
   openjpac directory=${artifact.output.path}/WEB-INF/classes
     fileset dir=src/java
         include name=com/excelfore/entity/E_*.java/
     /fileset
   /openjpac
 /target
 
 The classpath defined in taskdef is not used to find the entity classes,
 instead system class loader is used, and that class loader doesn't have
 access to the entity classes. For this task to work, the ant must be
 started with the class path sufficient to reach the entities. Normally,
 during build time, these things don't exist yet, and normally, you would
 expect the enhancer to be a part of a larger build.
 
 
 Thank you,
   Pawel.



Re: [DISCUSS] JDO usage end-of-life?

2011-10-11 Thread Mark Struberg
There is a JDO-3.0 spec out there since almost a year now. I'm not sure if we 
can/like to catch up. 

Isn't there a pure JDO impl at db.apache.org which is up2date anyway?


LieGrue,
strub



- Original Message -
 From: Michael Dick michael.d.d...@gmail.com
 To: users@openjpa.apache.org; d...@openjpa.apache.org
 Cc: 
 Sent: Tuesday, October 11, 2011 4:21 AM
 Subject: Re: [DISCUSS] JDO usage end-of-life?
 
T here is at least some interest from a subset of our users. Matthew Adams
 and issue: OPENJPA-1744
 https://issues.apache.org/jira/browse/OPENJPA-1744to add support for
 JDO last July. I closed the issue, but Matthew responded
 and the issue was reopened.
 
 There hasn't been a lot of activity on the JIRA since then. There are some
 users watching it, but no one has voted for it. If there's an outpouring of
 support from the users list, and a committer (or aspiriing committer) is
 interested in championing the effort, I'd be all for adding a JDO persona.
 Absent a champion who is ready to dive into the code, I think that we should
 clean up the references to jdo.
 
 Even if OpenJPA removes the references to JDO, I'm sure a separate module
 could be written that sits on top of our binaries. I suspect that's what BEA
 / Oracle did.
 
 -mike
 
 
 
 On Mon, Oct 10, 2011 at 8:18 AM, Kevin Sutter kwsut...@gmail.com wrote:
 
  Hi,
  Sorry to cross post to both forums, but I wanted to ensure that I hit
  everybody that might have an opinion on this JDO topic...
 
  Is the JDO personality of OpenJPA still being utilized?  Marc's recent 
 post
  about possibly pulling in javax.jdo.* packages during the enhancement
  processing [1] reminded me that we still have old remnants of JDO (and
  Kodo)
  in the OpenJPA code base.  OpenJPA has never claimed support for JDO (nor
  Kodo).  Way back when, BEA provided a JDO implementation as part of their
  offering that sat on top of OpenJPA.  As far as I know, BEA (and Oracle)
  only support the 1.1.x service stream of OpenJPA.  So, if we did this in
  the
  2.x stream, there should be no effects to that set of users.
 
  Would there be a concern with the current users of OpenJPA to clean up the
  code base and remove these JDO/Kodo references?  From a JPA/OpenJPA
  perspective, you should see no differences in functionality.
 
  Like I said, Marc's posting prompted me to revisit this topic.  I'm 
 just
  exploring the option with no immediate plans of actually doing the work...
 
  Thanks,
  Kevin
 
  [1]
 
 
 http://openjpa.208410.n2.nabble.com/weird-JDO-Exception-when-using-OpenJPA-2-Enhancer-tc6870122.html
 



Re: openJPA dependcies with latest openJPA-2.1.x and javax.persistance.PersistanceProvider / javaee-apo

2011-08-19 Thread Mark Struberg
regarding tomcat:

vi conf/catalina.properties

add the following line
shared.loader=${catalina.base}/webapps/lib/*.jar

then put all your shared classes into webapps/lib.
This is kind of an EAR scenario without EJBs ;)
The SharedClassLoader will become the parent of all WebappClassLoaders.

LieGrue,
strub

--- On Thu, 8/18/11, Michael Dick michael.d.d...@gmail.com wrote:

 From: Michael Dick michael.d.d...@gmail.com
 Subject: Re: openJPA dependcies with latest openJPA-2.1.x and 
 javax.persistance.PersistanceProvider / javaee-apo
 To: d...@openjpa.apache.org, users@openjpa.apache.org
 Date: Thursday, August 18, 2011, 3:31 PM
 Hi Sebastian,
 
 The binary downloads of OpenJPA includes the Java EE jars
 we use with
 OpenJPA (look in the lib directory). The spec
 implementations we use come
 from Geronimo, but any Java EE 6.0 compliant version of the
 API should work
 for you.
 
 You can also find these jars in the maven central
 repository at :
 http://search.maven.org/#search|ga|1|a%3A%22geronimo-jpa_2.0_spec%22http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22geronimo-jpa_2.0_spec%22
 
 I did check the geronimo-jpa jar and it does contain a few
 geronimo specific
 classes, I believe these are used with OSGi and should not
 cause any
 problems for you.
 
 I'm sorry I don't have sufficient experience with Tomcat to
 give advice on
 where the jars should go. Hopefully someone else on the
 list can help with
 that.
 
 -mike
 
 On Thu, Aug 18, 2011 at 10:28 AM, Craig L Russell
 craig.russ...@oracle.comwrote:
 
  Cross posting from users...
 
  Can anyone help?
 
  Craig
 
  Begin forwarded message:
 
   From: seba.wag...@gmail.com
 seba.wag...@gmail.com
  Date: August 18, 2011 12:24:04 AM PDT
  To: users@openjpa.apache.org
  Subject: openJPA dependcies with latest
 openJPA-2.1.x and
  javax.persistance.**PersistanceProvider /
 javaee-apo
  Reply-To: users@openjpa.apache.org
 
 
  Hi,
 
  we are migrating a larger Open Source project
 (OpenMeetings) from
  Hibernate
  to openJPA for Apache incubation and face some
 issues with openJPA's
  dependencies to
 javax.persistance.**PersistanceProvider:
 
 
  We already have the javaee-api-5.1.1.jar (
  http://openmeetings.**googlecode.com/svn/trunk/**
 
 singlewebapp/server/red5/lib/**javaee-api-5.1.1.jarhttp://openmeetings.googlecode.com/svn/trunk/singlewebapp/server/red5/lib/javaee-api-5.1.1.jar
  )
  in the servers lib that has an incompatible
 version of the interface
  javax.persistance.**PersistanceProvide.
  The application server is a modified Tomcat server
 integrated with Spring.
 
  Now the questions is:
  When we use the openjpa-2.1.x-all.jar and remove
 the javax.persistance.*
  classes from javaee-api-5.1.1.jar we HAVE to move
 openjpa-2.1.x-all.jar to
  the servers/lib (instead of
 webapps/openmeetings/WEB-INF/**lib) because
  the
  application server itself needs the
 javax.perstistance.* classes available
  too.
 
  Separating the javax.perstistance.* from the
 openjpa-2.1.x-all.jar and
  just
  moving that to the server-lib doesn't work too as
 those
  javax.perstistance.*
  from the openjpa-2.1.x-all.jar seem to have some
 depencies to
  *apache.geronimo.xyz*.
 
  So my questions are:
  Where can we get a javax.persistance.* library
 that is compatible with
  openJPA-2.1.x ? The one from the maven directory:
  http://download.java.net/**maven/2/javax/javaee-api/6.0/http://download.java.net/maven/2/javax/javaee-api/6.0/does
 NOT work. It
  throws some Exception about invalid class. Seems
 like a compile error in
  their build server.
 
  Where is the best place to put the openJPA-2.1.x
 JAR(s) ? Servers-lib or
  WEB-INF/lib ? We want to be able to deploy
 multiple times the
  openmeetings-webapp into the same applications
 server. From my point of
  view
  you have to put them into WEB-INF/lib then?
 
 
  Thank you very much,
  Sebastian
 
 
  --
  Sebastian Wagner
  http://www.webbase-design.de
  http://openmeetings.**googlecode.com
 http://openmeetings.googlecode.com
  http://www.wagner-sebastian.**com http://www.wagner-sebastian.com
  seba.wag...@gmail.com
 
 
  Craig L Russell
  Architect, Oracle
  http://db.apache.org/jdo
  408 276-5638 mailto:Craig.Russell@oracle.**com craig.russ...@oracle.com
  P.S. A good JDO? O, Gasp!
 
 



Re: Possibility to return detached objects from a query?

2011-08-14 Thread Mark Struberg
I also roughly remember that we even generate different bytecode (at least when 
using compile time enhancement) depending on the persistence.xml version. 
Safest bet is to use version 2.0.
Guess this was done to improve compatibility with older projects.

LieGrue,
strub

--- On Fri, 8/12/11, Rick Curtis curti...@gmail.com wrote:

 From: Rick Curtis curti...@gmail.com
 Subject: Re: Possibility to return detached objects from a query?
 To: users@openjpa.apache.org
 Date: Friday, August 12, 2011, 5:44 PM
 I knew this sounded familiar. It
 looks like I found this problem quite a
 while back and haven't got around to fixing the bug.
 
 https://issues.apache.org/jira/browse/OPENJPA-1672
 
 On Fri, Aug 12, 2011 at 11:23 AM, Michael Pflueger
 michael.pflue...@sma.dewrote:
 
  Seems that would be 1.0 then.
 
  See my other post containing a testcase/src folder
 including a
  persistence.xml.
 
  I hope this helps reproducing the problem.
 
  Michael
 
  -Ursprüngliche Nachricht-
  Von: Michael Dick [mailto:michael.d.d...@gmail.com]
  Gesendet: Freitag, 12. August 2011 18:04
  An: users@openjpa.apache.org
  Betreff: Re: Possibility to return detached objects
 from a query?
 
  Some of the detach behavior depends on the version in
 your persistence.xml
  file. It's kind of a shot in the dark, but are you
 validating against
  version 2.0, or 1.0?
 
  -mike
 
  On Fri, Aug 12, 2011 at 9:56 AM, Michael Pflueger
  michael.pflue...@sma.dewrote:
 
   Hi Rick,
  
   Yes, I'm using 2.2 trunk, ~1 week old.
  
   I did try LRS in the past, but as I encountered a
 bug there I switched
  away
   from it.
   This bug seems to be fixed in trunk, but I could
 only use LRS for
  Importing
   data anyway, as our main DB is MySQL, which lacks
 proper LRS support with
   concurrent queries.
  
   Thus, I wrote a simple query chunker which loads
 a chunk  of results from
   the db, provides an iterator, and upon reaching
 the end automatically
  loads
   the next chunk, etc.
  
   So, I could try LRS for the purpose of debugging
 etc, but it should work
   without them aswell.
  
   And Yes! After a quick check, with
 CopyOnDetach=false, OpenJPA behaves as
   expected and does not use more than about 30MB of
 Heap space and most
   importantly stays in that range. (as long as I
 detach my entities :)
  
   Thanks!
  
   I'd still be interested whether it's a bug in the
 copyOnDetach=true
   codepath or if it is working as designed that the
 manager keeps managed
   copies on detachment?
  
   -Ursprüngliche Nachricht-
   Von: Rick Curtis [mailto:curti...@gmail.com]
   Gesendet: Donnerstag, 11. August 2011 16:11
   An: users@openjpa.apache.org
   Betreff: Re: Possibility to return detached
 objects from a query?
  
   Michael -
  
While I still wonder about why detaching my
 entities doesn't reduce my
   heap memory usage
   You didn't mention what level of code you are
 running on, but if it is 
   2.0, it might be a bug. Try setting the following
 property: property
   name=openjpa.Compatibility
 value=CopyOnDetach=false/
  
also wonder whether there is a possibility
 for a query to return
  detached
   objects in the first place?
   I'm not aware of one. That doesn't mean the
 capability doesn't exist, I'm
   just not aware of it :)
  
Calling detach() for every object looks to
 be rather expensive
   Correct, in some of our performance testing we
 have found that detach is
   quite expensive. I put in a property
 LiteAutoDetach which is in place to
   quickly detach the entire persistence context,
 but unfortunately this
   optimization isn't available for detaching single
 instances.
  
   I know I missed an email you sent to this list a
 number of days ago where
   you were asking a very similar question. I don't
 want to derail this
   thread,
   but have you looked at large result sets[1]? The
 might simplify some of
   your
   loading code.
  
  
   [1]
  
  
  http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_dbsetup_lrs
  
   Thanks,
   Rick
  
   On Thu, Aug 11, 2011 at 2:06 AM, Michael
 Pflueger
   michael.pflue...@sma.dewrote:
  
Hi,
   
While I still wonder about why detaching my
 entities doesn't reduce my
   heap
memory usage,
I also wonder whether there is a possibility
 for a query to return
   detached
objects in the first place?
This might be quite efficient for scenarios
 where you need to read lots
   of
data but not update it or need any other
 features of a managed entity.
Calling detach() for every object looks to
 be rather expensive, and
  above
method would not only avoid that but could
 possibly avoid some
  attachment
overhead aswell.
   
 ___
   
SMA Solar Technology AG
Aufsichtsrat: Guenther Cramer
 (Vorsitzender)
Vorstand: Juergen Dolle, Roland Grebe, Uwe
 Hertel, Pierre-Pascal Urbon,
Marko Werner
Handelsregister: Amtsgericht Kassel HRB
 

Re: Audit log with OpenJPA

2011-07-27 Thread Mark Struberg
Hi!

I've now looked at your test code and I'm not sure if it really is expected to 
work.
The JPA spec imo isn't very clear about  exactly _when_ the @PreUpdate gets 
called.

From the JPA-2.0 spec:
The PreUpdate and PostUpdate callbacks occur before and after the database 
update operations to entity data respectively. These database operations may 
occur at the time the entity state is updated or they may occur at the time 
state is flushed to the database (which may be at the end of the transaction).
Note that it is implementation-dependent as to whether PreUpdate and PostUpdate 
call- backs occur when an entity is persisted and subsequently modified in a 
single transaction or when an entity is modified and subsequently removed 
within a single transaction. Portable applications should not rely on such 
behavior.

It also doesn't say whether it will get called if the flush is performed for 
getting reproducible selects, etc.

Also the term 'entity data' caused a lot discussions already. What happens with 
a  EllementCollection or a CascadeType.PERSIST 1:n which is stored in your 
class? This obviously will render data in a different table. So is this covered 
by 'entity data'  or not?

There are lots of details in the JPA spec and not everything works as expected 
once you leave the simple samples and touch more complicated areas like lazy 
loading, fetch groups, detached entities, etc… You should for example try to 
close your EntityManager in your test (forces a detach) and then create a new 
one afterwards.

Of course you are relying on OpenJPA specific code, so you can argue that you 
don't need portability to other JPA providers at all. But still: it's not even 
guaranteed within OpenJPA that such subtle behavior will not change.
I'm also not sure if it's allowed to create a new entity within the same 
EntityManager while it is getting committed. I remember that I tried that and 
got an Exception because you cannot modify the EM while it is in the process of 
getting committed. But not 100% sure yet (grey cells refuse to find the 
paragraph in the docs) - Pinaki, you know what I mean and can shed a light on 
it? txs!

Of course it imo IS doable with OpenJPA, but it's definitely not a straight way 
;)
The StateManager code needs a bit of tweaking anyway. You could take a look at 
OPENJPA-1873 to get an idea about it ;)
I've already debugged into the StateManager stuff a big time and am ready to 
help out once we know how we'd like to solve this. 

LieGrue,
strub

--- On Tue, 7/26/11, Bengt Rodehav be...@rodehav.com wrote:

 From: Bengt Rodehav be...@rodehav.com
 Subject: Re: Audit log with OpenJPA
 To: users@openjpa.apache.org
 Date: Tuesday, July 26, 2011, 11:35 PM
 Yes, you're right Pinaki.
 
 I've attached a test case to the JIRA now. I'm very
 interested in your
 verdict...
 
 /Bengt
 
 2011/7/26 Pinaki Poddar ppod...@apache.org
 
  Hi Bengt,
   This thread has grown too lengthy for me to find
 where was the @PreUpdate
  code.
  For better convergence, please create a JUnit test and
 post it to
  OPENJPA-2030 [1]
 
 
  [1] https://issues.apache.org/jira/browse/OPENJPA-2030
 
  -
  Pinaki Poddar
  Chair, Apache OpenJPA Project
  --
  View this message in context:
  http://openjpa.208410.n2.nabble.com/Audit-log-with-OpenJPA-tp6557932p6623086.html
  Sent from the OpenJPA Users mailing list archive at
 Nabble.com.
 



Re: Audit log with OpenJPA

2011-07-19 Thread Mark Struberg
Yes, I just mentioned it because in my case it made a _huge_ difference when 
working with previously detached entities which got em.merged().

I don't know the exact scenario, but since EntityManagers are not Serializable, 
there is detachment needed in a lot cases. At least if you need it also working 
in a cluster or load balancer scenario. 

LieGrue,
strub

--- On Tue, 7/19/11, Pinaki Poddar ppod...@apache.org wrote:

 From: Pinaki Poddar ppod...@apache.org
 Subject: Re: Audit log with OpenJPA
 To: users@openjpa.apache.org
 Date: Tuesday, July 19, 2011, 2:47 PM
 Hi Bengt,
   It is not obvious to me how DetachState related
 options will impact
 in-transaction entities. But I am interested to know the
 result of your
 experiment with the options Mark has suggested.
 
   I will recommend you make sure the following
   1. Enhance at build time 
   2. Set openjpa.RestoreState=true
 
  
   
 
 -
 Pinaki Poddar
 Chair, Apache OpenJPA Project
 --
 View this message in context: 
 http://openjpa.208410.n2.nabble.com/Audit-log-with-OpenJPA-tp6557932p6599036.html
 Sent from the OpenJPA Users mailing list archive at
 Nabble.com.



Re: Audit log with OpenJPA

2011-07-19 Thread Mark Struberg
Yes, I just mentioned it because in my case it made a _huge_ difference when 
working with previously detached entities which got em.merged().

I don't know the exact scenario, but since EntityManagers are not Serializable, 
there is detachment needed in a lot cases. At least if you need it also working 
in a cluster or load balancer scenario. 

LieGrue,
strub

--- On Tue, 7/19/11, Pinaki Poddar ppod...@apache.org wrote:

 From: Pinaki Poddar ppod...@apache.org
 Subject: Re: Audit log with OpenJPA
 To: users@openjpa.apache.org
 Date: Tuesday, July 19, 2011, 2:47 PM
 Hi Bengt,
   It is not obvious to me how DetachState related
 options will impact
 in-transaction entities. But I am interested to know the
 result of your
 experiment with the options Mark has suggested.
 
   I will recommend you make sure the following
   1. Enhance at build time 
   2. Set openjpa.RestoreState=true
 
  
   
 
 -
 Pinaki Poddar
 Chair, Apache OpenJPA Project
 --
 View this message in context: 
 http://openjpa.208410.n2.nabble.com/Audit-log-with-OpenJPA-tp6557932p6599036.html
 Sent from the OpenJPA Users mailing list archive at
 Nabble.com.



Re: Audit log with OpenJPA

2011-07-16 Thread Mark Struberg
It does keep track, but you might need to experiment a bit with your 
persistence.xml. In my case (doing lots of detached work), I needed the 
following settings:

property name=openjpa.DetachState 
value=loaded(DetachedStateField=true)/
property name=openjpa.Compatibility 
value=IgnoreDetachedStateFieldForProxySerialization=true/

Be aware that some of those settings radically change the way OpenJPA works 
internally. But otherwise detached, merging, etc does not really work as this 
area is pretty under-specced.
I also remember that I needed to fix a few things to get the correct state in 
OPENJPA-1873. Not sure how much of this patch got already committed (got my 
time eaten up by a few other Apache projects lately).

LieGrue,
stru 

--- On Sat, 7/16/11, Bengt Rodehav be...@rodehav.com wrote:

 From: Bengt Rodehav be...@rodehav.com
 Subject: Re: Audit log with OpenJPA
 To: users@openjpa.apache.org
 Date: Saturday, July 16, 2011, 8:40 PM
 Did you have a suggestion regarding
 this Pinaki - or does OpenJPA only keep
 track of changed values - not the whole original object?
 
 /Bengt
 
 2011/7/15 Bengt Rodehav be...@rodehav.com
 
  I don't understand Pinaki.
 
  The this pointer is the current version of the
 object (the one that is
  about to be persisted) right? I want the previous
 version of the object. I
  have used your code from the blog (and added some of
 course) like this:
 
  *
 
      PersistenceCapable
 currentState = (PersistenceCapable) this;
 
      StateManagerImpl sm =
 (StateManagerImpl)
  currentState.pcGetStateManager();
 
      SaveFieldManager sfm =
 sm.getSaveFieldManager();
 
      PersistenceCapable
 oldState = sfm.getState();
 
      EntityBase old =
 (EntityBase) oldState;
 
      old = (EntityBase)
 oldState;
 
 
      AuditLogEntry entry =
 new AuditLogEntry();
 
  
    entry.setSerializedState(cAuditLog.serialize(old));
 
  
    entry.setEntityId(old.getId());
 
  
    entry.setCreatedWhen(old.getCreatedWhen());
 
  
    entry.setCreatedBy(old.getCreatedBy());
 
  
    entry.setUpdatedWhen(old.getUpdatedWhen());
 
  
    entry.setUpdatedBy(old.getUpdatedBy());
 
  
    entry.setVersion(old.getVersion());
 
 
 
      EntityManager em =
 OpenJPAPersistence.getEntityManager(this);
 
      em.persist(entry);
 
 
  *
 
 
  cAuditLog is an object which uses Gson to serialize
 the object to a String.
 
  The problem is that only those fields that I have
 actually updated are
  initialized in the variable old. The rest of the
 fields are uninitialized.
  In my case I do not only want to save the changed
 fields but the whole
  object. How can I make sure that old is fully
 initialized?
 
  /Bengt
 
  2011/7/15 Pinaki Poddar ppod...@apache.org
 
  The whole object is *this* pointer on which you
 received the callback.
  You can safely cast it into PersistenceCapable and
 get to know all about
  its
  state.
 
  Please see the blog post -- it has some toy code.
 
  -
  Pinaki Poddar
  Chair, Apache OpenJPA Project
  --
  View this message in context:
  http://openjpa.208410.n2.nabble.com/Audit-log-with-OpenJPA-tp6557932p6585154.html
  Sent from the OpenJPA Users mailing list archive
 at Nabble.com.
 
 
 



Re: Audit log with OpenJPA

2011-07-07 Thread Mark Struberg
Hi Folks!

I also use auditing with OpenJPA:
http://struberg.wordpress.com/2010/07/31/howto-changelog-with-jpa/

but it currently only works with a patched OpenJPA 2.2.x version.
https://issues.apache.org/jira/browse/OPENJPA-1873

We fixed a few parts already, but the POST_LOAD_ON_MERGE isn't yet submitted 
since we didn't quite agree if it is spec conform.

LieGrue,
strub


--- On Thu, 7/7/11, Pinaki Poddar ppod...@apache.org wrote:

 From: Pinaki Poddar ppod...@apache.org
 Subject: Re: Audit log with OpenJPA
 To: users@openjpa.apache.org
 Date: Thursday, July 7, 2011, 7:58 PM
 Hi,
   Good to see lot of new ideas about auditing.
   Here is one more [1] that uses OpenJPA specific
 internals of accessing the
 original state of an entity.
 The comparison of the current state and original state to
 decide upon the
 audit message is provided trivially in this example -- but
 at the level at
 which OpenJPA API is being accessed here, much more
 facilities are available
 to compute the 'delta'. 
   
 [1]   
 http://webspherepersistence.blogspot.com/2009/01/auditing-with-openjpa.html
 
 -
 Pinaki 
 --
 View this message in context: 
 http://openjpa.208410.n2.nabble.com/Audit-log-with-OpenJPA-tp6557932p6559730.html
 Sent from the OpenJPA Users mailing list archive at
 Nabble.com.



Re: OpenJPA maven plugin configuration

2011-07-01 Thread Mark Struberg
Hi Jim!

I know it's a bit of a hack, but the openjpa-maven-plugin uses the compile 
classpath of your project. So I'd say it's not really a 'bug'.

You should be able to prevent this side effect by adding a dependency to your 
plugin section which contains such a logback-test.xml file with your test 
logging configuration.

LieGrue,
strub

--- On Thu, 6/30/11, Jim Talbut jtal...@spudsoft.co.uk wrote:

 From: Jim Talbut jtal...@spudsoft.co.uk
 Subject: OpenJPA maven plugin configuration
 To: users@openjpa.apache.org
 Date: Thursday, June 30, 2011, 5:36 AM
 Hi,
 
 Whenever the openjpa-maven-plugin (v1.2 or v1.1) runs it
 initialises logback (which is a dependency of my project,
 it's not explicitly mentioned by the plugin configuration),
 which finds the logback.xml file, but not the
 logback-test.xml file.
 The logback.xml file has configuration that is only
 relevant to a live installation, and as a result it causes
 unwanted files to be created in my source tree.
 
 In order to stop logback doing this I need to be able to
 either specify a custom system property when
 openjpa-maven-plugin runs, or add the test resource path to
 the classpath so that logback finds logback-test.xml.
 
 I can't find any way to do either of these things, is
 either possible?
 If not, could one of them be added to the next version?
 
 Thanks
 
 Jim
 


Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

2011-06-07 Thread Mark Struberg
Hiho!

It seems that your Datasource or any other setting in your persistence.xml 
needs some spring classes.

Please try to add a dependencies section with those dependencies directly to 
the plugin section!

plugin
   artifactIdopenjpa-maven-plugin...
...
   dependencies
 dependency
   groupIdorg.springframework...
   artifactId...
   version...
 /dependency
   /dependencies
/plugin


LieGrue,
strub


--- On Tue, 6/7/11, infinity2heaven infinity2hea...@gmail.com wrote:

 From: infinity2heaven infinity2hea...@gmail.com
 Subject: Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK
 To: users@openjpa.apache.org
 Date: Tuesday, June 7, 2011, 5:21 PM
 Tried exactly as you mentioned. The
 classes are being enhanced with
 implements org.apache.openjpa.enhance.PersistenceCapable.
 Still get the same
 error.
 
 Dumping the stack trace from the unit test being run via
 eclipse. 
 
 java.lang.IllegalStateException: Failed to load
 ApplicationContext
     at
 org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
     at
 org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
     at
 org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
     at
 org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
     at
 org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220)
     at
 org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
     at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
     at
 org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
     at
 org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
     at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
     at
 org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
     at
 org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
     at
 org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
     at
 org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
     at
 org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
     at
 org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
     at
 org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
     at
 org.junit.runners.ParentRunner.run(ParentRunner.java:236)
     at
 org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
     at
 org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
     at
 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
     at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
     at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
     at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
 Caused by:
 org.springframework.beans.factory.BeanCreationException:
 Error
 creating bean with name 'profileSeedData' defined in file
 [C:\projects\tcms\TCMS.ProfileMaintenance\target\classes\xxx\profile\SeedData.class]:
 Invocation of init method failed; nested exception is
 openjpa-1.2.2-r422266:898935 nonfatal user error
 org.apache.openjpa.persistence.ArgumentException: This
 configuration
 disallows runtime optimization, but the following listed
 types were not
 enhanced at build time or at class load time with a
 javaagent: [class
 xxx.profile.entity.AccountType, class
 xxx.profile.entity.ProfileLoadError,
 class xxx.profile.entity.Aba, class xxx.profile.entity.Can,
 class
 xxx.profile.entity.ProfileAudit, class
 xxx.profile.entity.ProfileAuditDetail, class
 xxx.profile.entity.ErrorCode].
     at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
     at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
     at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
     at
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
     at
 

Re: Enhancement under Eclipse Helios

2011-05-29 Thread Mark Struberg
Hi!

I didn't yet use eclipse-3.6 but I was successfully able to use 
openjpa-maven-plugin with eclpise-3.5 and idea 9.0 to 10.5.

Which openjpa-maven-plugin do you use? The one from codehaus, or our new one 
over here from openjpa directly? They should basically be the same, but just in 
case we messed up something...

LieGrue,
strub

--- On Fri, 5/27/11, No1UNo je...@jerrycarter.org wrote:

 From: No1UNo je...@jerrycarter.org
 Subject: Re: Enhancement under Eclipse Helios
 To: users@openjpa.apache.org
 Date: Friday, May 27, 2011, 6:41 PM
 I've filed a bug report with M2E
 lt;https://bugs.eclipse.org/bugs/show_bug.cgi?id=347494.
 
 More broadly, is anyone able to do build-time enhancement
 in Eclipse 3.6
 with Maven?
 
 
 --
 View this message in context: 
 http://openjpa.208410.n2.nabble.com/Enhancement-under-Eclipse-Helios-tp6411954p6412128.html
 Sent from the OpenJPA Users mailing list archive at
 Nabble.com.
 


Re: Enhancement under Eclipse Helios

2011-05-29 Thread Mark Struberg
Oki, please could you try the following scenarios:


1.) 
invoking 
$mvn openjpa:enhance 
on the commandline in your project.

2.) 
invoke the process-classes phase from within eclipse.

For both scenarios:
Does Eclipse pickup your enhanced classes? Can you run a unit test from within 
eclipse this way?

If 1.) isn't working too, then it looks like Eclipse has got a huge 
regression...

LieGrue,
strub


--- On Sun, 5/29/11, No1UNo je...@jerrycarter.org wrote:

 From: No1UNo je...@jerrycarter.org
 Subject: Re: Enhancement under Eclipse Helios
 To: users@openjpa.apache.org
 Date: Sunday, May 29, 2011, 11:16 AM
 
 Strub:
 
 The three key components are Eclipse 3.6.2, m2e 0.13, and 
 openjpa-maven-plugin 2.2.0-SNAPSHOT as per:
 
 groupIdorg.apache.openjpa/groupId
 artifactIdopenjpa-maven-plugin/artifactId
 version2.2.0-SNAPSHOT/version
 
 The m2e plugin is blocking enhancement by
 openjpa-maven-plugin.  This was a change in m2e from
 earlier versions which worked fine.
 
 -=- Jerry
 
 
 
 On May 29, 2011, at 6:17 AM, Mark Struberg [via OpenJPA]
 wrote:
 
  Hi! 
  
  I didn't yet use eclipse-3.6 but I was successfully
 able to use openjpa-maven-plugin with eclpise-3.5 and idea
 9.0 to 10.5. 
  
  Which openjpa-maven-plugin do you use? The one from
 codehaus, or our new one over here from openjpa directly?
 They should basically be the same, but just in case we
 messed up something... 
  
  LieGrue, 
  strub 
  
  --- On Fri, 5/27/11, No1UNo [hidden email]
 wrote: 
  
   From: No1UNo [hidden email] 
   Subject: Re: Enhancement under Eclipse Helios 
   To: [hidden email] 
   Date: Friday, May 27, 2011, 6:41 PM 
   I've filed a bug report with M2E 
   lt;https://bugs.eclipse.org/bugs/show_bug.cgi?id=347494.
 
   
   More broadly, is anyone able to do build-time
 enhancement 
   in Eclipse 3.6 
   with Maven? 
   
   
   -- 
   View this message in context: 
   http://openjpa.208410.n2.nabble.com/Enhancement-under-Eclipse-Helios-tp6411954p6412128.html
   Sent from the OpenJPA Users mailing list archive
 at 
   Nabble.com. 
   
  
  
  If you reply to this email, your message will be added
 to the discussion below:
  http://openjpa.208410.n2.nabble.com/Enhancement-under-Eclipse-Helios-tp6411954p6416285.html
  To start a new topic under OpenJPA Users, email
 ml-node+208411-1703014788-244...@n2.nabble.com
 
  To unsubscribe from OpenJPA Users, click here.
 
 
 
 --
 View this message in context: 
 http://openjpa.208410.n2.nabble.com/Enhancement-under-Eclipse-Helios-tp6411954p6416341.html
 Sent from the OpenJPA Users mailing list archive at
 Nabble.com.


  1   2   >