Re: problem when persist object using JOINED inhertitance under 1.1.0

2008-08-25 Thread devu213


Another observation is that if I'm persisting a base class subclass
hierarchy twice in two methods, like I'm doing, the first invocation fails.
However openJPA now understands the inheritance hierarchy properly and the
subsequent call succeeds with openJPA firing the inserts in the proper
order.

I stand corrected. The above observation is incorrect as I have today
discovered that the behaviour is well and truly random. Sometimes openJPA
fires queries in the correct order, sometimes it fires queries for the child
class twice instead of parent class first and child class later. 

I also tried using an orm.xml (instead of annotations) without any success.

Here is my database schema...


create table .CUSTOMER
(
   PBS_NO   DECIMAL(8) not null,
   CVR_NO   DECIMAL(8) not null,
   SP_NODECIMAL(10),
   BP_NODECIMAL(10),
   BP_NO_OWNER  CHAR(4),
   HREG_NO  DECIMAL(4),
   PREFIX   CHAR(10),
   NAME1VARCHAR(70),
   NAME2VARCHAR(70),
   ADDR1VARCHAR(70),
   ADDR2VARCHAR(70),
   ADDR3VARCHAR(70),
   POSTAL_CDCHAR(10)   not null,
   CITY VARCHAR(70),
   COUNTRY_CD   CHAR(2),
   LANG_CD  CHAR(4),
   START_DT DATE   not null,
   VAL_START_DT DATE   not null,
   VAL_END_DT   DATE   not null,
   UPDATE_BYCHAR(10)   not null,
   UPDATE_TSTIMESTAMP  not null,
   constraint PK_CU primary key (PBS_NO)
);


create table .CREDITOR
(
   PBS_NO   DECIMAL(8) not null,
   CRED_TYPEVARCHAR(20)not null,
   BILLING_TYPE CHAR(4)not null,
   PREMIUM_CUST_FLG CHAR(1),
   START_DT DATE   not null,
   VAL_START_DT DATE   not null,
   VAL_END_DT   DATE   not null,
   UPDATE_BYCHAR(10)   not null,
   UPDATE_TSTIMESTAMP  not null,
   constraint PK_CR primary key (PBS_NO)
);
alter table .CREDITOR
   add constraint F_FK_CU foreign key (PBS_NO)
  references .CUSTOMER (PBS_NO)
  on delete no action;



devu213 wrote:
> 
> Subsequent to my last post, I have tried the code on versions 1.0.2 and
> 1.2.0. It fails on both ( in addition to 1.1.0 on which I originally tried
> it).
> 
> Another observation is that if I'm persisting a base class subclass
> hierarchy twice in two methods, like I'm doing, the first invocation
> fails. However openJPA now understands the inheritance hierarchy properly
> and the subsequent call succeeds with openJPA firing the inserts in the
> proper order.
> 
> This seemingly trivial piece of code is giving me a lot of strife not to
> mention the fact that I went on a wild goose chase thinking the problem
> lay somewhere else.
> 
> Can someone please help me out here ?? I have attached my SQL trace log
> which should give some pointers.
> 
> Is Inheritancetype.JOINED working for anyone with any version. Can someone
> please verify and tell me what I'm doing wrong ?
>  http://n2.nabble.com/file/n781623/openjpa.log openjpa.log 
> 
> 
> 
> 
> Acton Wang wrote:
>> 
>> 
>> hi, 
>>  
>>   I used 1.1.0 to try to implement a simple JOINED inhertance  using
>> orm.xml:
>>  
>>  
>>  > strategy="JOINED"/> > name="PARTYID" column-definition="VARCHAR(200)" nullable="false"/>  
>> 
>> ...  > name="Child"/>  > referenced-column-name="PARTYID"/> > name="fullRegisteredName">> column-definition="VARCHAR(200)" updatable="true" insertable="true"/>  
>> .
>> 
>> when I try to persist multiple Child objects, the first one would be
>> ok but the following ones will fail and from trace, it seems that it
>> keeps inserting into the "Child" table 2 times instead of being inserting
>> Parent table first then Child table.
>>  
>> It looks no problem if I run it under 1.0.2 version. Is it a bug?
>>  
>> Thx
>> Acton
>> 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/problem-when-persist-object-using-JOINED-inhertitance-under-1.1.0-tp580291p783275.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: sql ordering

2008-08-25 Thread Georgi Naplatanov
Hello, Pinaki.

> Nope. Unique constraints can be placed by annotations/xml descriptors. But
> the topological sorting algorithm that imposes an order on sql
statements to
> satisfy both database constraints and object-level operations do not
> consider unique constraints.

You are right, but i think that OperationOrderUpdateManager satisfy most
of possible scenarios to not violate particular unique constraint.

Scenario 1
update old (1-> x)
insert new (1)

Scenario 2
delete old (1)
insert new (1)

Scenario 3
update old (1 -> x)
update old (y -> 1)

In case i understand the logic of

OperationOrderUpdateManager.flush(RowManager rowMgr,
PreparedStatementManager psMgr, Collection exceps)

method correctly, it executes :
 1. delete statements
 2. updated rows with changed primary or foreign key
 3. rest of operations which are in the order of application logic.

The only possible scenario to violate unique constraint is Scenario 3,
when second row changes its foreign key and its update be executed first.

BTW: Why there are so complex implementations of UpdateManager rather
single, simple ApplicationOrderUpdateManager ?

Best regards
Georgi

Pinaki Poddar wrote:
> Hi,
>> That's great news; I did not think unique constraints had been fixed. 
> 
> Nope. Unique constraints can be placed by annotations/xml descriptors. But
> the topological sorting algorithm that imposes an order on sql statements to
> satisfy both database constraints and object-level operations do not
> consider unique constraints. 
> 
> So if a transaction removes x1 and inserts x2 while x1 and x2 has the same
> value for a unique non-primary column then OpenJPA *does not* ensure that
> DELETE x1 will be issued before INSERT x2.  
> 


Re: slow performance on MySql 5.0

2008-08-25 Thread Georgi Naplatanov
Hello, Kevin, thank you for ideas.

I didn't think to pool EntityManager instances. I definitely  will try it.

Best regards
Georgi

Kevin Sutter wrote:
> Georgi,
> One of the first areas I would look at is the creation and destruction of
> the EntityManagers.  You mention that you are running with an extended
> context, but does the application create or pool EntityManagers?  Although
> our testing has been with IBM databases, we have found that we get the best
> performance with the minimum number of EntityManager creations.  If you can
> clear and reuse the EntityManagers, the overall performance will be better.
> 
> There is another cache that helps with sql generation as well.  It has a
> couple of restrictions, but if the majority of your queries are simple
> findby operations, this cache will help considerably.  The property is
> QuerySQLCache and it is documented in the OpenJPA 1.2.x manual (
> http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/manual.html#ref_guide_cache_querysql
> ).
> 
> Hope this helps with getting better performance.
> 
> Kevin
> 
> On Mon, Aug 25, 2008 at 3:21 PM, Georgi Naplatanov <[EMAIL PROTECTED]> wrote:
> 
>> Hello,
>>
>> I'm porting SQL/JDBC web application to JPA and i made some performance
>> tests with PostgreSQL 8.3.3 and MySql 5.0.51a Community edition, with
>> both - SQL/JDBC and OpenJPA implementations of the application.
>>
>>Apache ab   Apache Jmeter
>> PostgreSQL 8.3   -15%   -12%
>> MySql 5.0.51a-64%   -27%
>>
>> On both tests on PostgreSQL the performance loss is about 15% compared
>> to pure SQL/JDBC implementation.
>>
>> On MySql the performance loss is very big especially on test with Apache
>> ab utility.
>>
>> In the tests, OpenJPA 1.2.0 is configured with data cache enabled, query
>> data cache disabled and query compilation cache - enabled. OpenJPA
>> operates in extended context with Apache DBCP and statement pooling.
>>
>> Is this performance loss on MySql normal ? Does OpenJPA require some
>> special configuration for MySql ?
>>
>> It is my persistence.xml file.
>>
>> > value="DriverClassName=com.mysql.jdbc.Driver,
>> Url=jdbc:mysql://localhost/mydb,
>> Username=root,
>> Password=123,
>> maxActive=25,
>> maxWait=25,
>> minIdle=3,
>> maxIdle=25,
>> whenExhaustedAction=block,
>> testOnBorrow=false,
>> testWhileIdle=true,
>> timeBetweenEvictionRunsMillis=360,
>> numTestsPerEvictionRun=3,
>> minEvictableIdleTime=180,
>> testQuery=select 1,
>> poolPreparedStatements=true"/>
>>  > value="org.apache.commons.dbcp.BasicDataSource"/>
>>
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> >
>> value="org.apache.openjpa.jdbc.sql.MySQLDictionary(SupportsSubselect=true)"/>
>>
>> Best regards
>> Georgi
>>
> 



Re: Embed on Secondary Table

2008-08-25 Thread Pinaki Poddar

Hi,
  If you can update OpenJPA from trunk and verify whether the fix works for
you or not, please let us know.


-- 
View this message in context: 
http://n2.nabble.com/Embed-on-Secondary-Table-tp782286p782779.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Embed on Secondary Table

2008-08-25 Thread Pinaki Poddar

Hi,
> The secondary table does have the join column CUST_ID.
Good.

Recent commit 688919 on trunk on OPENJPA-705 has a fix. 


-- 
View this message in context: 
http://n2.nabble.com/Embed-on-Secondary-Table-tp782286p782776.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Embed on Secondary Table

2008-08-25 Thread atilla

The secondary table does have the join column CUST_ID. I only mentioned the
extra columns!
The wrong column is actually an additional column. I can see that the insert
statement for CUSTOMER_EXT has both CUST_ID and DATERANGE_CUST_ID Cols.

-- 
View this message in context: 
http://n2.nabble.com/Embed-on-Secondary-Table-tp782286p782768.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Embed on Secondary Table

2008-08-25 Thread Pinaki Poddar

Hi,
> I have COLUMNS FROM_DT, TO_DT in CUSTOMER_EXT and I am using a class
> DateRange which maps 
> those columns.

Secondary table CUSTOMER_EXT need to have a join column CUST_ID to refer to
primary key column of CUSTOMER.CUST_ID. However, your observation does point
to a error in OpenJPA as it generates 
a column named DATERANGE_CUST_ID instead of CUST_ID as specified in
@SecondaryTable(pkJoinColumns=...).

The problem is logged as JIRA report  OPENJPA-705.

Currently you can perhaps workaround as 
@SecondaryTable(name = "CUSTOMER_EXT", pkJoinColumns =
@PrimaryKeyJoinColumn(name = "DATERANGE_CUST_ID", referencedColumnName =
"CUST_ID"))


[1] https://issues.apache.org/jira/browse/OPENJPA-705

-- 
View this message in context: 
http://n2.nabble.com/Embed-on-Secondary-Table-tp782286p782706.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: sql ordering

2008-08-25 Thread Pinaki Poddar

Hi,
> That's great news; I did not think unique constraints had been fixed. 

Nope. Unique constraints can be placed by annotations/xml descriptors. But
the topological sorting algorithm that imposes an order on sql statements to
satisfy both database constraints and object-level operations do not
consider unique constraints. 

So if a transaction removes x1 and inserts x2 while x1 and x2 has the same
value for a unique non-primary column then OpenJPA *does not* ensure that
DELETE x1 will be issued before INSERT x2.  

-- 
View this message in context: 
http://n2.nabble.com/sql-ordering-tp779562p782703.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: sql ordering

2008-08-25 Thread Reece Garrett
That's great news; I did not think unique constraints had been fixed. Thank you 
for letting me know!

-Reece

>>> Georgi Naplatanov <[EMAIL PROTECTED]> 8/25/2008 1:40 PM >>>
Hello, Reece, you are happy man. This problem seems solved. I tested it
with OpenJPA 1.2.0.

You have to declare you unique constraint in the persistence class(es)
something like:

@Entity
@Table(name="my_table_name",
[EMAIL PROTECTED](columnNames={"my_field1_id",
"my_field2_id"}))
public class MyClass {
.
.

and to add following property to pesistence.xml file



Best regards
Georgi

Reece Garrett wrote:
> Georgi,
> 
> Perhaps I misunderstood your original post. My problem was related to the 
> ordering of insert/delete/and update statements. For example, if in the same 
> transaction I delete a row with a unique column value A and also insert a row 
> with unique column value A OpenJPA will sometimes do the insert before the 
> delete and violate the unique constraint. And since I'm forced to use a DBMS 
> that does not support differed constraints I need OpenJPA to order statements 
> such that unique constraints aren't violated.
> 
> It sounds like your problem is considerably different than mine.
> 
> -Reece
> 
 Georgi Naplatanov <[EMAIL PROTECTED]> 8/25/2008 12:31 PM >>>
> Hello, Reece.
> 
> I switched on OpenJPA logging and in some situations OpenJPA try to
> insert 2 rows with the same values of constraint's fields which violates
> unique constraint.
> It occurs only  when query's data cache is enabled (it is enabled by
> default).
> 
> Is your problem stopping raise when you switch off query data cache ?
> 
> At this time i can not isolate the problem and i can not prepare a test
> case which will reproduce this problem. It is the reason to not open an
> issue report.
> 
> Reece Garrett wrote:
>> Hello,
>>
>> You may want to look at http://issues.apache.org/jira/browse/OPENJPA-235. I 
>> was having problems with OpenJPA violating foreign key constraints because 
>> of the order SQL statements ran. Later I found, as have you, that unique 
>> constraints are also violated. Foreign keys now seem to be working but 
>> unique constraints are still a problem. At one point I was conversing with 
>> Markus Fuchs about the problem but we both got busy and nothing got done. My 
>> JIRA was closed with instructions that other cases which need addressing 
>> should be placed in a separate JIRA. So you should open a new JIRA and link 
>> it to OPENJPA-235.
>>
>> -Reece 
>>
> Georgi Naplatanov <[EMAIL PROTECTED]> 8/24/2008 4:46:06 AM >>>
>> Hello, everybody.
>>
>> Is there a way to be executed generated SQL statements in order in which
>> application passes them to OpenJPA ?
>>
>> I tried "operation-order" implementation, but it reorders statements and
>> violates unique constraints in the database despite they are declared in
>> persistence classes, even query data cache is switched on.
>>
>> Best regards
>> Georgi
>>
>>
>>
>>
>>
> 
> 




Re: slow performance on MySql 5.0

2008-08-25 Thread Kevin Sutter
Georgi,
One of the first areas I would look at is the creation and destruction of
the EntityManagers.  You mention that you are running with an extended
context, but does the application create or pool EntityManagers?  Although
our testing has been with IBM databases, we have found that we get the best
performance with the minimum number of EntityManager creations.  If you can
clear and reuse the EntityManagers, the overall performance will be better.

There is another cache that helps with sql generation as well.  It has a
couple of restrictions, but if the majority of your queries are simple
findby operations, this cache will help considerably.  The property is
QuerySQLCache and it is documented in the OpenJPA 1.2.x manual (
http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/manual.html#ref_guide_cache_querysql
).

Hope this helps with getting better performance.

Kevin

On Mon, Aug 25, 2008 at 3:21 PM, Georgi Naplatanov <[EMAIL PROTECTED]> wrote:

> Hello,
>
> I'm porting SQL/JDBC web application to JPA and i made some performance
> tests with PostgreSQL 8.3.3 and MySql 5.0.51a Community edition, with
> both - SQL/JDBC and OpenJPA implementations of the application.
>
>Apache ab   Apache Jmeter
> PostgreSQL 8.3   -15%   -12%
> MySql 5.0.51a-64%   -27%
>
> On both tests on PostgreSQL the performance loss is about 15% compared
> to pure SQL/JDBC implementation.
>
> On MySql the performance loss is very big especially on test with Apache
> ab utility.
>
> In the tests, OpenJPA 1.2.0 is configured with data cache enabled, query
> data cache disabled and query compilation cache - enabled. OpenJPA
> operates in extended context with Apache DBCP and statement pooling.
>
> Is this performance loss on MySql normal ? Does OpenJPA require some
> special configuration for MySql ?
>
> It is my persistence.xml file.
>
>  value="DriverClassName=com.mysql.jdbc.Driver,
> Url=jdbc:mysql://localhost/mydb,
> Username=root,
> Password=123,
> maxActive=25,
> maxWait=25,
> minIdle=3,
> maxIdle=25,
> whenExhaustedAction=block,
> testOnBorrow=false,
> testWhileIdle=true,
> timeBetweenEvictionRunsMillis=360,
> numTestsPerEvictionRun=3,
> minEvictableIdleTime=180,
> testQuery=select 1,
> poolPreparedStatements=true"/>
>   value="org.apache.commons.dbcp.BasicDataSource"/>
>
> 
> 
> 
> 
> 
> 
> 
> 
> value="org.apache.openjpa.jdbc.sql.MySQLDictionary(SupportsSubselect=true)"/>
>
> Best regards
> Georgi
>


Re: sql ordering

2008-08-25 Thread Georgi Naplatanov
Hello, Reece, you are happy man. This problem seems solved. I tested it
with OpenJPA 1.2.0.

You have to declare you unique constraint in the persistence class(es)
something like:

@Entity
@Table(name="my_table_name",
[EMAIL PROTECTED](columnNames={"my_field1_id",
"my_field2_id"}))
public class MyClass {
.
.

and to add following property to pesistence.xml file



Best regards
Georgi

Reece Garrett wrote:
> Georgi,
> 
> Perhaps I misunderstood your original post. My problem was related to the 
> ordering of insert/delete/and update statements. For example, if in the same 
> transaction I delete a row with a unique column value A and also insert a row 
> with unique column value A OpenJPA will sometimes do the insert before the 
> delete and violate the unique constraint. And since I'm forced to use a DBMS 
> that does not support differed constraints I need OpenJPA to order statements 
> such that unique constraints aren't violated.
> 
> It sounds like your problem is considerably different than mine.
> 
> -Reece
> 
 Georgi Naplatanov <[EMAIL PROTECTED]> 8/25/2008 12:31 PM >>>
> Hello, Reece.
> 
> I switched on OpenJPA logging and in some situations OpenJPA try to
> insert 2 rows with the same values of constraint's fields which violates
> unique constraint.
> It occurs only  when query's data cache is enabled (it is enabled by
> default).
> 
> Is your problem stopping raise when you switch off query data cache ?
> 
> At this time i can not isolate the problem and i can not prepare a test
> case which will reproduce this problem. It is the reason to not open an
> issue report.
> 
> Reece Garrett wrote:
>> Hello,
>>
>> You may want to look at http://issues.apache.org/jira/browse/OPENJPA-235. I 
>> was having problems with OpenJPA violating foreign key constraints because 
>> of the order SQL statements ran. Later I found, as have you, that unique 
>> constraints are also violated. Foreign keys now seem to be working but 
>> unique constraints are still a problem. At one point I was conversing with 
>> Markus Fuchs about the problem but we both got busy and nothing got done. My 
>> JIRA was closed with instructions that other cases which need addressing 
>> should be placed in a separate JIRA. So you should open a new JIRA and link 
>> it to OPENJPA-235.
>>
>> -Reece 
>>
> Georgi Naplatanov <[EMAIL PROTECTED]> 8/24/2008 4:46:06 AM >>>
>> Hello, everybody.
>>
>> Is there a way to be executed generated SQL statements in order in which
>> application passes them to OpenJPA ?
>>
>> I tried "operation-order" implementation, but it reorders statements and
>> violates unique constraints in the database despite they are declared in
>> persistence classes, even query data cache is switched on.
>>
>> Best regards
>> Georgi
>>
>>
>>
>>
>>
> 
> 



slow performance on MySql 5.0

2008-08-25 Thread Georgi Naplatanov
Hello,

I'm porting SQL/JDBC web application to JPA and i made some performance
tests with PostgreSQL 8.3.3 and MySql 5.0.51a Community edition, with
both - SQL/JDBC and OpenJPA implementations of the application.

Apache ab   Apache Jmeter
PostgreSQL 8.3   -15%   -12%
MySql 5.0.51a-64%   -27%

On both tests on PostgreSQL the performance loss is about 15% compared
to pure SQL/JDBC implementation.

On MySql the performance loss is very big especially on test with Apache
ab utility.

In the tests, OpenJPA 1.2.0 is configured with data cache enabled, query
data cache disabled and query compilation cache - enabled. OpenJPA
operates in extended context with Apache DBCP and statement pooling.

Is this performance loss on MySql normal ? Does OpenJPA require some
special configuration for MySql ?

It is my persistence.xml file.


  










Best regards
Georgi


Re: sql ordering

2008-08-25 Thread Reece Garrett
Georgi,

Perhaps I misunderstood your original post. My problem was related to the 
ordering of insert/delete/and update statements. For example, if in the same 
transaction I delete a row with a unique column value A and also insert a row 
with unique column value A OpenJPA will sometimes do the insert before the 
delete and violate the unique constraint. And since I'm forced to use a DBMS 
that does not support differed constraints I need OpenJPA to order statements 
such that unique constraints aren't violated.

It sounds like your problem is considerably different than mine.

-Reece

>>> Georgi Naplatanov <[EMAIL PROTECTED]> 8/25/2008 12:31 PM >>>
Hello, Reece.

I switched on OpenJPA logging and in some situations OpenJPA try to
insert 2 rows with the same values of constraint's fields which violates
unique constraint.
It occurs only  when query's data cache is enabled (it is enabled by
default).

Is your problem stopping raise when you switch off query data cache ?

At this time i can not isolate the problem and i can not prepare a test
case which will reproduce this problem. It is the reason to not open an
issue report.

Reece Garrett wrote:
> Hello,
> 
> You may want to look at http://issues.apache.org/jira/browse/OPENJPA-235. I 
> was having problems with OpenJPA violating foreign key constraints because of 
> the order SQL statements ran. Later I found, as have you, that unique 
> constraints are also violated. Foreign keys now seem to be working but unique 
> constraints are still a problem. At one point I was conversing with Markus 
> Fuchs about the problem but we both got busy and nothing got done. My JIRA 
> was closed with instructions that other cases which need addressing should be 
> placed in a separate JIRA. So you should open a new JIRA and link it to 
> OPENJPA-235.
> 
> -Reece 
> 
 Georgi Naplatanov <[EMAIL PROTECTED]> 8/24/2008 4:46:06 AM >>>
> Hello, everybody.
> 
> Is there a way to be executed generated SQL statements in order in which
> application passes them to OpenJPA ?
> 
> I tried "operation-order" implementation, but it reorders statements and
> violates unique constraints in the database despite they are declared in
> persistence classes, even query data cache is switched on.
> 
> Best regards
> Georgi
> 
> 
> 
> 
> 




Re: sql ordering

2008-08-25 Thread Georgi Naplatanov
Hello, Reece.

I switched on OpenJPA logging and in some situations OpenJPA try to
insert 2 rows with the same values of constraint's fields which violates
unique constraint.
It occurs only  when query's data cache is enabled (it is enabled by
default).

Is your problem stopping raise when you switch off query data cache ?

At this time i can not isolate the problem and i can not prepare a test
case which will reproduce this problem. It is the reason to not open an
issue report.

Reece Garrett wrote:
> Hello,
> 
> You may want to look at http://issues.apache.org/jira/browse/OPENJPA-235. I 
> was having problems with OpenJPA violating foreign key constraints because of 
> the order SQL statements ran. Later I found, as have you, that unique 
> constraints are also violated. Foreign keys now seem to be working but unique 
> constraints are still a problem. At one point I was conversing with Markus 
> Fuchs about the problem but we both got busy and nothing got done. My JIRA 
> was closed with instructions that other cases which need addressing should be 
> placed in a separate JIRA. So you should open a new JIRA and link it to 
> OPENJPA-235.
> 
> -Reece 
> 
 Georgi Naplatanov <[EMAIL PROTECTED]> 8/24/2008 4:46:06 AM >>>
> Hello, everybody.
> 
> Is there a way to be executed generated SQL statements in order in which
> application passes them to OpenJPA ?
> 
> I tried "operation-order" implementation, but it reorders statements and
> violates unique constraints in the database despite they are declared in
> persistence classes, even query data cache is switched on.
> 
> Best regards
> Georgi
> 
> 
> 
> 
> 



Embed on Secondary Table

2008-08-25 Thread atilla

I have two Tables CUSTOMER and CUSTOMER_EXT (mapped as Secondary)

@[EMAIL PROTECTED](name = "CUSTOMER")
@SecondaryTable(name = "CUSTOMER_EXT", pkJoinColumns =
@PrimaryKeyJoinColumn(name = "CUST_ID", referencedColumnName = "CUST_ID"))

I have COLUMNS FROM_DT, TO_DT in CUSTOMER_EXT and I am using a class
DateRange which maps those columns.

I am trying to embed this class and persist in the Secondary Table.

//Customer.class embeds DateRange.class
@Embedded
@AttributeOverrides( {
@AttributeOverride(name = "from", column = @Column(name = "FROM_DT", table =
"CUSTOMER_EXT")),
@AttributeOverride(name = "to", column = @Column(name = "TO_DT", table =
"CUSTOMER_EXT"))} )
private DateRange dr;

When I do this it tries to insert into a column named DATERANGE_CUST_ID in
CUSTOMER_EXT which obviously is not there.
Any Clues? 
-- 
View this message in context: 
http://n2.nabble.com/Embed-on-Secondary-Table-tp782286p782286.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Embed on Secondary Table

2008-08-25 Thread atilla

I have two Tables CUSTOMER and CUSTOMER_EXT (mapped as Secondary)

@[EMAIL PROTECTED](name = "CUSTOMER")
@SecondaryTable(name = "CUSTOMER_EXT", pkJoinColumns =
@PrimaryKeyJoinColumn(name = "CUST_ID", referencedColumnName = "CUST_ID"))

I have COLUMNS FROM_DT, TO_DT in CUSTOMER_EXT and I am using a class
DateRange which maps those columns.

I am trying to embed this class and persist in the Secondary Table. 

//Customer.class embeds DateRange.class
@Embedded
@AttributeOverrides( {
@AttributeOverride(name = "from", column = @Column(name = "FROM_DT", table =
"CUSTOMER_EXT")),
@AttributeOverride(name = "to", column = @Column(name = "TO_DT", table =
"CUSTOMER_EXT"))} )
private DateRange dr;

When I do this it tries to insert into a column named DATERANGE_CUST_ID in
CUSTOMER_EXT which obviously is not there.
Any Clues? 
-- 
View this message in context: 
http://n2.nabble.com/Embed-on-Secondary-Table-tp782270p782270.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: @VersionColumns usage

2008-08-25 Thread Dinkar Rao

Will try it out and post back the results soon.

Thanks,
Dinkar

On Mon, Aug 25, 2008 at 11:13 AM, Pinaki Poddar
<[EMAIL PROTECTED]> wrote:
> Hi,
>   That is a good use case -- how about augmenting/adding a test case to
> verify that my fix will cope or not when version columns span across primary
> and secondary tables?
>
>
>
> 
> Subscribed to Nabble @
> http://n2.nabble.com/%40VersionColumns-usage-tp736463p736463.html
> To unsubscribe, click here.
>

-- 
View this message in context: 
http://n2.nabble.com/%40VersionColumns-usage-tp736463p782172.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: @VersionColumns usage

2008-08-25 Thread Pinaki Poddar

Hi,
  That is a good use case -- how about augmenting/adding a test case to
verify that my fix will cope or not when version columns span across primary
and secondary tables?


-- 
View this message in context: 
http://n2.nabble.com/%40VersionColumns-usage-tp736463p782167.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: @VersionColumns usage

2008-08-25 Thread Dinkar Rao
Another unconfirmed use case I heard of, different than the one
assumed in Pinaki's fix, is that @Versions is specified when an
entity's fields are spread across multiple secondary tables. The
primary table and each secondary table have their own version columns,
and when any attribute of a table is updated, JPA tracks the
corresponding version field for that table.

Thanks,
Dinkar

On Mon, Aug 25, 2008 at 10:25 AM, Pinaki Poddar <[EMAIL PROTECTED]> wrote:
>
> Hi Craig,
>  Perhaps, in legacy situations, where the JPA application may not own all
> the version columns and other apps may be updating one or more of them. But
> I can not remember seeing a real use case.
>
>  Regards --
> --
> View this message in context: 
> http://n2.nabble.com/%40VersionColumns-usage-tp736463p782044.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>


Re: sql ordering

2008-08-25 Thread Reece Garrett
Hello,

You may want to look at http://issues.apache.org/jira/browse/OPENJPA-235. I was 
having problems with OpenJPA violating foreign key constraints because of the 
order SQL statements ran. Later I found, as have you, that unique constraints 
are also violated. Foreign keys now seem to be working but unique constraints 
are still a problem. At one point I was conversing with Markus Fuchs about the 
problem but we both got busy and nothing got done. My JIRA was closed with 
instructions that other cases which need addressing should be placed in a 
separate JIRA. So you should open a new JIRA and link it to OPENJPA-235.

-Reece 

>>> Georgi Naplatanov <[EMAIL PROTECTED]> 8/24/2008 4:46:06 AM >>>
Hello, everybody.

Is there a way to be executed generated SQL statements in order in which
application passes them to OpenJPA ?

I tried "operation-order" implementation, but it reorders statements and
violates unique constraints in the database despite they are declared in
persistence classes, even query data cache is switched on.

Best regards
Georgi







Re: @VersionColumns usage

2008-08-25 Thread Pinaki Poddar

Hi Craig,
  Perhaps, in legacy situations, where the JPA application may not own all
the version columns and other apps may be updating one or more of them. But
I can not remember seeing a real use case. 

  Regards --
-- 
View this message in context: 
http://n2.nabble.com/%40VersionColumns-usage-tp736463p782044.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



RE: Fetch Group questions

2008-08-25 Thread Pinaki Poddar

Hi Michael,
  Yes, the field inclusion in fetch group is determined by the field's name
with the declaring class and not by the defining class. 

 The recent commit 688777, adds the behavior you want. So 
   FetchPlan.addField(A.class, "b");
   FetchPlan.addField(B.class, "code");
 should fetch {A.b, A.b.code} but not {A.code}.

 I have added a JIRA issue to track [1].

 Let me know if you can try the recent changes and whether it addresses your
use case.

 Regards --

[1] https://issues.apache.org/jira/browse/OPENJPA-704
[2]
http://n2.nabble.com/svn-commit%3A-r688777---in--openjpa-trunk-openjpa-kernel-src-main-java-org-apache-openjpa%3A-kernel-FetchConfigurationImpl.java-meta-FieldMetaData.java-tc781976.html



-- 
View this message in context: 
http://n2.nabble.com/Fetch-Group-questions-tp534861p782029.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: @VersionColumns usage

2008-08-25 Thread Craig L Russell
I'm not clear on the use case for multiple version columns. Does  
anyone have an example of where it is useful?


Craig

On Aug 25, 2008, at 7:58 AM, Pinaki Poddar wrote:



Hi,
 A recent commit on OPENJPA-697 upgrades the version column strategy  
for

multiple numeric columns.
A simple test case is available in the commit set as demonstration  
of usage.
When a version value is represented as multiple column values,  
comparison of

the version values poses some open questions.
Currently, the comparison of v1 and v2 (when v1 and v2 are array of  
version

column values) is as follows:
 if (compare(v1[i], v2[i]) = x for all i then return x
 if (compare(v1[i], v2[i]) = x for some i and 0 for all other i then  
return

x
 otherwise return 1.

A bit heuristic but am ready to listen to other ideas.

--
View this message in context: 
http://n2.nabble.com/%40VersionColumns-usage-tp736463p781659.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Craig L Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!



smime.p7s
Description: S/MIME cryptographic signature


Re: Problems with configuring OpenJPA "Slices"

2008-08-25 Thread Pinaki Poddar

Hi,
  > I don't know hoe i implement the DistributionPolicy interface

  Added is an example policy that distributes between two slices named "One"
and "Two" based on the first letter in Person's name. To use this policy in
your configuration:



/**
 * Exemplar [EMAIL PROTECTED] DistributionPolicy} that maintains closure and
distributes
 * based on attributes of the given instance. 
 * 
 * @author Pinaki Poddar 
 *
 */
package org.apache.openjpa.slice.policy;

import java.util.List;

import org.apache.openjpa.slice.DistributionPolicy;

import org.apache.openjpa.slice.PObject;
import org.apache.openjpa.slice.Person;

public class UserDistributionPolicy implements DistributionPolicy {

/**
 * Distribute the given instance.
 * Assumes that two configured slices are named as One and 
 * Two.
 * The policy is only implemented for PObject and Person i.e. two of 
three 
 * known classes. No policy is implemented for Address because Address 
is
 * persisted always by cascade and hence Slice should assign 
automatically
 * the same slice as its owner Person. 
 * 
 */
public String distribute(Object pc, List slices, Object 
context) {
assertValidSlices(slices);
if (pc instanceof PObject)
return distribute((PObject)pc);
if (pc instanceof Person) {
return distribute((Person)pc);
}
throw new RuntimeException("No policy for " + pc.getClass());
}

void assertValidSlices(List slices) {
if (slices.contains("One") && slices.contains("Two"))
return;
throw new RuntimeException("This policy assumes two slices 
named " +
"One and Two. But configured slices are " + 
slices); 
}

/**
 * Distribute PObject based on odd-even value of its id.
 */
String distribute(PObject pc) {
return (pc.getId()%2 == 0) ? "One" : "Two";
}

/**
 * Distribute Person based on first character of its name.
 */
String distribute(Person pc) {
return (pc.getName().startsWith("A")) ? "One" : "Two";
}
}


thiago ananias wrote:
> 
> 
> My "persistence.xml" is in this post and i specified the " name="openjpa.BrokerFactory" value="slice"/>"
> 
> I don't know hoe i implement the DistributionPolicy interface
> 
> i think that's wrong in my code!
> 
> thanks
> 
> 
> Pinaki Poddar wrote:
>> 
>> Hi, 
>>   this line from stack trace
>>>org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:784)
>> 
>>   indicates that the correct configuration has not been picked up.
>> 
>>   Did you specify 
>>
>> 
>>   in your persistence.xml file?
>> 
>> 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Problems-with-configuring-OpenJPA-%22Slices%22-tp759642p781677.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: @VersionColumns usage

2008-08-25 Thread Pinaki Poddar

Hi,
  A recent commit on OPENJPA-697 upgrades the version column strategy for
multiple numeric columns.
A simple test case is available in the commit set as demonstration of usage.
When a version value is represented as multiple column values, comparison of
the version values poses some open questions. 
Currently, the comparison of v1 and v2 (when v1 and v2 are array of version
column values) is as follows:
  if (compare(v1[i], v2[i]) = x for all i then return x
  if (compare(v1[i], v2[i]) = x for some i and 0 for all other i then return
x
  otherwise return 1.

A bit heuristic but am ready to listen to other ideas.

-- 
View this message in context: 
http://n2.nabble.com/%40VersionColumns-usage-tp736463p781659.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: problem when persist object using JOINED inhertitance under 1.1.0

2008-08-25 Thread devu213

Subsequent to my last post, I have tried the code on versions 1.0.2 and
1.2.0. It fails on both ( in addition to 1.1.0 on which I originally tried
it).

Another observation is that if I'm persisting a base class subclass
hierarchy twice in two methods, like I'm doing, the first invocation fails.
However openJPA now understands the inheritance hierarchy properly and the
subsequent call succeeds with openJPA firing the inserts in the proper
order.

This seemingly trivial piece of code is giving me a lot of strife not to
mention the fact that I went on a wild goose chase thinking the problem lay
somewhere else.

Can someone please help me out here ?? I have attached my SQL trace log
which should give some pointers.

Is Inheritancetype.JOINED working for anyone with any version. Can someone
please verify and tell me what I'm doing wrong ?
http://n2.nabble.com/file/n781623/openjpa.log openjpa.log 




Acton Wang wrote:
> 
> 
> hi, 
>  
>   I used 1.1.0 to try to implement a simple JOINED inhertance  using
> orm.xml:
>  
>  
>   strategy="JOINED"/>  name="PARTYID" column-definition="VARCHAR(200)" nullable="false"/>   
> ...   name="Child"/>   referenced-column-name="PARTYID"/>  name="fullRegisteredName"> column-definition="VARCHAR(200)" updatable="true" insertable="true"/>  
> .
> 
> when I try to persist multiple Child objects, the first one would be
> ok but the following ones will fail and from trace, it seems that it keeps
> inserting into the "Child" table 2 times instead of being inserting Parent
> table first then Child table.
>  
> It looks no problem if I run it under 1.0.2 version. Is it a bug?
>  
> Thx
> Acton
> 

-- 
View this message in context: 
http://n2.nabble.com/problem-when-persist-object-using-JOINED-inhertitance-under-1.1.0-tp580291p781623.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: injected entityManager is not compatible with OpenJPAEntityManager

2008-08-25 Thread Pinaki Poddar

Hi,
  Instead of 
 OpenJPAEntityManager oem = (OpenJPAEntityManager) em;
  try
OpenJPAEntityManager oem = OpenJPAPersistence.cast(em);



-- 
View this message in context: 
http://n2.nabble.com/problem-when-persist-object-using-JOINED-inhertitance-under-1.1.0-tp580291p781619.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



JPQL-UPDATE + refresh() sets collections to NULL

2008-08-25 Thread Sebastian Gauder

I have the following piece of Code:

static ConcurrentLinkedQueue bands;
...
public int perform(EntityManager em) {
   Band b = em.merge(bands.poll());
try {
   String statement = "UPDATE Band AS b " +
   "SET b.name='The "+b.getName()+"'"+
   " WHERE b.id="+b.getId();
   Query query = em.createQuery(statement);
   query.executeUpdate();
  
   statement = "UPDATE Album AS a " +

   "SET a.name='The "+b.getName()+"'"+
   " WHERE a.id="+b.getAlbums().get(0).getId();
   query = em.createQuery(statement);
   query.executeUpdate();
  
   if (b.getTour()!=null) {

   statement = "UPDATE Concert AS c " +
   "SET c.city='London' "+
   "WHERE c.id="+b.getTour().getConcerts().get(0).getId();
   query = em.createQuery(statement);
   query.executeUpdate();
   }
  
   em.refresh(b);

   bands.add(b);
  
   return 0;

   }
   catch (Exception e) {
   e.printStackTrace();
   return -1;
   }
   }



The Entity Band looks like this:

@Entity
@Table(name="JBT_Band")
public class Band {

   private Long id;

   @Id
   @GeneratedValue
   public Long getId() {
   return id;
   }

   public void setId(Long id) {
   this.id = id;
   }
  
   private String name;
  
   public String getName() {

   return name;
   }

   public void setName(String name) {
   this.name = name;
   }

  
   private List members;


   @OneToMany(cascade=ALL, mappedBy = "band")
   public List getMembers() {
   return members;
   }

   public void setMembers(List members) {
   this.members = members;
   }
  
   private Tour tour;


   @OneToOne(cascade=ALL, optional = true, mappedBy = "band")
   public Tour getTour() {
   return tour;
   }

   public void setTour(Tour tour) {
   this.tour = tour;
   }
  
   private List albums;


   @OneToMany(cascade=ALL, mappedBy = "band")
   public List getAlbums() {
   return albums;
   }

   public void setAlbums(List albums) {
   this.albums = albums;
   }
  
   private int scenario;


   public int getScenario() {
   return scenario;
   }

   public void setScenario(int scenario) {
   this.scenario = scenario;
   }
  
}


The method perform() is processed by up to 10 Threads at the same time. 
Each thread retrieves an entity 'Band' from a static and threadsafe 
queue and updates the according table and some related tables by 
JPQL-Queries.
The problem is, that after refresh() the lists 'albums' and 'members' 
are set to NULL which causes NullPointerExceptions in other places. Is 
this a bug in OpenJPA? (Code works in Hibernate and TopLink)


Regards,
Seb


Re: openJPA not working with DBUnit....

2008-08-25 Thread devu213

I have since realized that this problem has nothing to do with DBUnit. I was
trying to test an inheritance hierarchy with openJPA and that is failing. 
I have added to a separate post that already mentions a similar issue with
version 1.1.0


devu213 wrote:
> 
> I'm really having problems trying to make openJPA work with DBUnit. Here
> is a snippet of my test class. The moment I have a situation where DBUnit
> does some sort of initializing operations on the database, openJPA starts
> behaving really strangely. Specifically the second test method which uses
> inheritance fails to fire a query for the bae class. 
> 
> The moment I stop using DBUnit, everything starts working fine and openJPA
> fires the queries for the base class and derived class in the proper
> order. 
> 
> I've tried using two separate connections for DBUnit and openJPA and then
> finally passing a connection from openJPA to DBUnit. 
> 
> I really don't understand what is going wrongCan someone please give
> me some pointers?
> 
> 
> public class BaseDAOTest extends  BaseDBUnitTestCase {
>   
>   @Override
>   protected DatabaseOperation getSetUpOperation() {
>   return DatabaseOperation.DELETE;
>  //return DatabaseOperation.NONE;   //This
> works
> 
>   }
> 
>   @Override
>   protected IDataSet getDataSet() throws Exception {
>   return new FlatXmlDataSet(
>   
> ClassLoader.getSystemResourceAsStream("BaseDAOTestClean.xml"));
>   }
>   
>   protected IDataSet getDataSet(String datasetName) throws Exception {
>   return new FlatXmlDataSet(
>   
> ClassLoader.getSystemResourceAsStream(datasetName));
>   }
>   
>   
>   public void testCreate() {
>   System.out.println("testCreate");
>   EntityManager manager = null;
>   Customer customer = new Customer(new Double(123), new 
> Double(123), 
>   new String("DK1"), new Date(), new Date(),
>   new Date(), "KMD", new Date()); 
>   Customer anotherCustomer = new Customer(new Double(124), new
> Double(124), 
>   new String("DK2"), new Date(), new Date(),
>   new Date(), "ATP", new Date());
>   try {   
>   //Invocations to the processing logic
>   manager = PersistenceBootstrapper.getEntityManager();
>   EntityTransaction tx = manager.getTransaction();
>   tx.begin();
>   BaseDAO.create(manager, customer);
>   BaseDAO.create(manager, anotherCustomer);
>   tx.commit();
>   
>   //Do the asserts... Result verification.
>   ITable addedData = getConnection().createQueryTable(
>   "customer", 
>   "select pbs_no, cvr_no, 
> postal_cd," +
>   " update_by from customer 
> where" +
>   " pbs_no in (123, 124) order by 
> pbs_no");
>   Assertion.assertEquals(getDataSet("BaseDAOTest1.xml"), 
>   
> new DefaultDataSet(addedData));
>   } catch (Exception e) {
>   e.printStackTrace();
>   assertEquals("Failed", "Normal flow failed for 
> BaseDAOTest", 
>   e.getMessage());
>   } finally {
>   //Do this instead of closing the manager directly on 
> your own.
>   manager.close();
>   }
>   }
>   
> 
>   public void testCreateInheritance() {
>   System.out.println("testInheritacne");
>   //EntityManagerFactory factory =
> Persistence.createEntityManagerFactory("refimpl-nocontainer");
>   EntityManager manager = null;
>   Creditor creditor = new Creditor(new Double(125), new 
> Double(125), 
>   "DK3", new Date(), new Date(), new Date(), 
> "PROG", new Date()); 
>   try {
>   //Note the new dataset
>   IDataSet expectedDataset = 
> getDataSet("BaseDAOTest2.xml");
>   
>   //Invocations to the processing logic
>   manager = PersistenceBootstrapper.getEntityManager();
>   EntityTransaction transaction = 
> manager.getTransaction();
>   transaction.begin();
>   BaseDAO.create(manager, creditor);
>   transaction.commit()

injected entityManager is not compatible with OpenJPAEntityManager

2008-08-25 Thread Marc Logemann

Hi,

in my DAO i am injecting via Spring:

@PersistenceContext
private EntityManager em;

public void save(WSO wso) {
OpenJPAEntityManager oem = (OpenJPAEntityManager) em;
if (oem.isDetached(wso)) {
em.merge(wso);
} else {
em.persist(wso);
}
}

But the "em" is not compatible with OpenJPAEntityManager, so i get a  
ClassCastException. My  boostrapping code via Spring looks like this:



class 
="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">





And my persistence.xml:

http://java.sun.com/xml/ns/persistence";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xsi:schemaLocation="http://java.sun.com/xml/ns/ 
persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";

 version="1.0">

 
org.apache.openjpa.persistence.PersistenceProviderImplprovider>


value="buildSchema"/>






So how can i use methods only available in OpenJPAEntityManager? Its  
somehow ugly anyway to ask if its detached and then do a merge or  
persist. I couldnt remember that this was the case with Kodo.


Thx for ideas.

Marc


Re: problem when persist object using JOINED inhertitance under 1.1.0

2008-08-25 Thread devu213

I too get the exact same problem. In fact, it behaves quite wierdly in my
case.

 I have two methods doing the exact same thing i.e insert a  Creditor object
with different ID's. With the object hierarchy below, I expect it to fire a
Customer query insert and then a creditor query insert for both the methods.

However, openJPA behaves randomly. It sometimes does it right for one
method, sometimes for the other, sometimes none at all.

One thing that's consistent is that whenever i try and insert an object with
the ID already in the database, it fires the wrong inserts and throws an
error.

Also, I'm using the exact same version you mentioned i.e 1.1.0


Here is my test code

public class BaseDAOTest {


public void testCreateInheritance() {
System.out.println("testInheritacne");
EntityManager manager = null;
Creditor creditor = new Creditor(new Double(1004), new 
Double(659), 
"DK3", new Date(), new Date(), new Date(), 
"PROG", new Date()); 
try {


//Invocations to the processing logic
manager = FactoryTest.factory.createEntityManager();
EntityTransaction transaction = 
manager.getTransaction();
transaction.begin();
BaseDAO.create(manager, creditor);
transaction.commit();

} catch (Exception e) {
e.printStackTrace();
} finally {
//Do this instead of closing the manager directly on 
your own.

manager.close();
}
}

public void testCreateManyToOne() {
System.out.println("manytoone");
EntityManager manager = null;
Creditor creditor = new Creditor(new Double(1005), new 
Double(126), 
"DK3", new Date(), new Date(), new Date(), 
"PROG", new Date());

try {

//Invocations to the processing logic
manager = FactoryTest.factory.createEntityManager();
EntityTransaction transaction = 
manager.getTransaction();
transaction.begin();
BaseDAO.create(manager, creditor);

transaction.commit();

} catch (Exception e) {
e.printStackTrace();

} finally {
//Do this instead of closing the manager directly on 
your own.
//PersistenceBootstrapper.closeManager();
manager.close();
}
}

public static void main(String[] args) {
BaseDAOTest test = new BaseDAOTest();
test.testCreateInheritance();
test.testCreateManyToOne();
}
}


My object graph is as follows...

@Entity
@Table(name="Customer")
@Inheritance(strategy=InheritanceType.JOINED)
public class Customer  implements Serializable {

@Id
@Column(name="PBS_NO", nullable=false,length=8)
public Double pbsNo;

@Column(name="CVR_NO", nullable=false,length=8)
private Double cvrNo;



public Customer() {

}

public Customer(Double pbsNo, Double cvrNo, String postCode, Date
startDate,
Date valStartDate, Date valEndDate, String updateBy, Date 
updateTS) {
this.pbsNo = pbsNo;
this.cvrNo = cvrNo;
this.postCode = postCode;
this.startDate = startDate;
this.valStartDate = valStartDate;
this.valEndDate = valEndDate;
this.updateBy = updateBy;
this.updateTS = updateTS;
}

<>
}



@Entity
@Table(name="CREDITOR")
@PrimaryKeyJoinColumn(name="PBS_NO", referencedColumnName="PBS_NO")
public class Creditor extends Customer implements Serializable {

@Column(name="CRED_TYPE", nullable=false)
private String credType;

public Creditor() {
}



public Creditor(Double pbsNo, Double cvrNo, String postCode, Date
startDate,
Date valStartDate, Date valEndDate, String updateBy, Date 
updateTS) {

super(pbsNo, cvrNo, postCode, startDate, valStartDate, 

valEndDate, updateBy, updateTS);
this.credType = "Premium";
this.billType = "MTHL";
this.startDate = new Date();
this

Re: A merge problem

2008-08-25 Thread ZZflash

Sorry, this problem is resolved because I forgot to close the entityManager
of JPQL query

ZZflash wrote:
> 
> Hi,all 
>When I get a pojo with subclass list by JPQL, then use the merge method
> of entityManager to update the infomation of it, an exception is thrown,
> the exception is about excute an insert sql statment error. Why there is
> an insert sql statment but not an update?
> 

-- 
View this message in context: 
http://n2.nabble.com/A-merge-problem-tp780731p781053.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



RE: Fetch Group questions

2008-08-25 Thread Michael Vorburger
LOW: fyi, JIRA about earlier discussion point 2 created: 
https://issues.apache.org/jira/browse/OPENJPA-701


-Original Message-
From: Pinaki Poddar [mailto:[EMAIL PROTECTED] 
Sent: vendredi, 8. août 2008 19:41
To: users@openjpa.apache.org
Subject: RE: Fetch Group questions


hi,
  > 2. so if a future OpenJPA version would offer a way to override this,per 
attribute not globally, we could leverage that; but it's certainly not 
critical.  Do you want a JIRA for this?
  
   Yes. Why not?

  > 4. Would a JIRA help?
 A JIRA has been created 
  https://issues.apache.org/jira/browse/OPENJPA-671

--
View this message in context: 
http://n2.nabble.com/Fetch-Group-questions-tp534861p681237.html




• This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
• Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
• Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
• An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
• If you have received this email in error, please notify the sender immediately
  and delete the original.


RE: Fetch Group questions

2008-08-25 Thread Michael Vorburger
Hello again Pinaki et al,

We've run into a problem with FetchGroups which to me appears to be due
to an API Design limitation.  Example, simplified Entity pseudo code:

abstract class Base { String code; }

@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
class A extends Base { B b; }

@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
class B extends Base { }

We would like to Fetch A's with their asssociate B's and the code in the
B, but not in the A... see where I'm going? ;-) -- So addField(A.class,
"b"); and addField(Base.class, "code");  (NOT addField(B.class,
"code")... see doc).  The resulting SQL will JOIN A and B, but include
the 'code' from both A and B!

Is there any other (internal?) API to configure the FetchPlan more
precisely?  Do you agree this is a limitation in the current API, and
would you be open to address this in a future version (createa a JIRA?)
?

Thanks a lot,
Michael

--
View this message in context:
http://n2.nabble.com/Fetch-Group-questions-tp534861p681237.html




• This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
• Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
• Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
• An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
• If you have received this email in error, please notify the sender immediately
  and delete the original.


Re: Using Nested Embeddable/Embedded annotation.

2008-08-25 Thread KK

I am still waiting for any suggestion/reply

-

Regards,
KK

-- 
View this message in context: 
http://n2.nabble.com/Using-Nested-Embeddable-Embedded-annotation.-tp735658p780844.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.