openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey (JIRA)" <>
Subject [jira] Commented: (OPENJPA-236) No apparent way to generate all required SQL within a class derived from FullClassStrategy
Date Tue, 10 Jul 2007 22:01:05 GMT


Patrick Linskey commented on OPENJPA-236:

It's worth noting that some of the problems mentioned in this issue are really high-level
feature requests, and don't necessarily have anything to do with FullClassStrategy per se.

For example, David brings up the example of having a data model in which column names map
differently than what is specified in the JPA spec. This could be better accomplished with
an appropriate implementation of the MappingDefaults interface.

> No apparent way to generate all required SQL within a class derived from FullClassStrategy
> ------------------------------------------------------------------------------------------
>                 Key: OPENJPA-236
>                 URL:
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: kernel
>    Affects Versions: 0.9.7
>            Reporter: David Ezzio
>         Attachments:,
> FullClassStrategy has several optional methods for overriding OpenJPA's generation of
SQL. However, in a simple case, there is no apparent way to generate the required SQL within
a class derived from FullClassStrategy.
> The model consists of two classes, BizA which has a one-way, one-to-many relationship
to BizB. The relationship is mapped with a FK within the BizB table.
> The custom class strategy BizBMapping attempts to insert a BizB record and is able to
do so, provided that it is not contained within a BizA collection. Otherwise, the attempt
to persist a BizA with a contained BizB yields a SQL exception because OpenJPA generates additional
SQL that conflicts with the SQL generated within BizBMapping.customInsert. Even if OpenJPA
did not generate conflicting insert statement, there is no apparent way to get the value for
the A_ID column within the BizBMapping.customInsert method.
> This issue is critical for users who want to substitute their own SQL (such as calls
to stored procedures) for all of the OpenJPA generated SQL.
> Synopsis of the output log:
> INSERT INTO BIZB (ID, INFO) VALUES (?, ?) [params=(String) B22047141, (String) random]
> INSERT INTO BizA (id, info) VALUES (?, ?) [params=(String) A32968849, (String) random]
> INSERT INTO BizB (A_ID) VALUES (?) [params=(String) A32968849]
> SQLException: Column 'ID'  cannot accept a NULL value. 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message