You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Michael Dick (JIRA)" <ji...@apache.org> on 2008/06/05 19:55:45 UTC

[jira] Created: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

@JoinColumn with name attribute causes exception on 1.2.0. 
-----------------------------------------------------------

                 Key: OPENJPA-626
                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.2.0
            Reporter: Michael Dick


Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 

@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
       @JoinColumn(name="bus_stop_id")
       private BusStops busStop;

Works in release 1.0.2:

SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
t1.in_
service_date, t1.inbound, t1.latitude, t1.longitude,
t1.out_service_date, t1.sheltered, t1.street1_block,
t2.street_direction_id, t2.description, t1.street1_name, t1.street1
_qualifier, t3.street_type_id, t3.description, t1.street2_block,
t4.street_direction_id, t4.description, t1.street2_name,
t1.street2_qualifier, t5.street_type_id, t5.descrip
tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
t0.schedule_id, t0.stop_sequence, t0.terminu
s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
public.lk_street_directions t2 ON t1.st
reet1_direction = t2.street_direction_id LEFT OUTER JOIN
public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
OUTER JOIN public.lk_street_directions t4 ON t
1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
t0.schedule_id = ? ORDER BY t0.stop_seque
nce ASC [params=(int) 50]

Uses synthesized column name instead of declared name in today's CVS
snapshot:

ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
t1.out_service_date, t1.sheltered, t1.street1_block,
t2.street_direction_id, t2.description, t1.street1_name,
t1.street1_qualifier, t3.street_type_id, t3.description,
t1.street2_block, t4.street_direction_id, t4.description,
t1.street2_name, t1.street2_qualifier, t5.street_type_id,
t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
t0.transfer_point

FROM public.schedule_stops t0
 LEFT OUTER JOIN public.bus_stops t1
 ON t0.BUSSTOP_STOP_ID = t1.stop_id
 LEFT OUTER JOIN public.lk_street_directions t2
 ON t1.street1_direction = t2.street_direction_id
 LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
50]} [code=0, state=42703]



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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603770#action_12603770 ] 

Fay Wang commented on OPENJPA-626:
----------------------------------

Hi Tim, the values in  OPENJPA-626-vars-1.txt look fine. The join column names of "bus_stop_id" and "schedule_id" are properly parsed and saved into the foreign keys. If your sql is generated from find operation, the next you can do is to set a break point in JDBCStoreManager:

    public boolean select(Select sel, ClassMapping mapping, int subs,
        OpenJPAStateManager sm, BitSet fields, JDBCFetchConfiguration fetch,
        int eager, boolean ident, boolean outer) {
   ...
          if (eagerToMany != null)
                 eagerToMany.selectEagerJoin(sel, sm, this,    <== set break point here and step into it
                      fetch.traverseJDBC(eagerToMany), eager);  

You will need to step into it and see how the join columns are formed (you may eventually go to StoreCollectionFieldStrategy.selectEagerJoin).
If your sql is generated from dynamic query, you will need to set a break point in JDBCStoreQuery.executeQuery and debug through. 






> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Resolved: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick resolved OPENJPA-626.
----------------------------------

    Resolution: Invalid

Resolving this issue per remarks from Tim.

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-src-1.zip, OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Tim Holloway (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604496#action_12604496 ] 

Tim Holloway commented on OPENJPA-626:
--------------------------------------

Thank you Fay. The damage is definitely done at SQL generation time, but since the process looks like a series of refinements rather than a straight line, I'm having difficulty homing in on where the bad field name comes from.

One thing I noticed, however, if my eyes don't deceive me. The JOIN field names appear to be correct. Only the SELECT field name is wrong.

SELECT DISTINCT t0.route_id, t1.schedule_id, t1.schedule_stop_id, t2.stop_id, t2.description, t2.elevation, t2.in_service_date, t2.inbound, t2.latitude, t2.longitude, t2.out_service_date, t2.sheltered, t2.street1_block, t3.street_direction_id, t3.description, t2.street1_name, t2.street1_qualifier, t4.street_type_id, t4.description, t2.street2_block FROM public.schedules t0 LEFT OUTER JOIN public.schedule_stops t1 ON t0.schedule_id = t1.schedule_id LEFT OUTER JOIN public.bus_stops t2 ON t1.bus_stop_id = t2.stop_id LEFT OUTER JOIN public.lk_street_directions t3 ON t2.street1_direction = t3.street_direction_id LEFT OUTER JOIN public.lk_street_types t4 ON t2.street1_type = t4.street_type_id LEFT OUTER JOIN public.lk_street_directions t5 ON t2.street2_direction = t5.street_direction_id ORDER BY t1.schedule_id ASC, t1.stop_sequence ASC

Note that the 3d selected field is the offending "t1.schedule_stop_id", but the actual join to the stops table is "LEFT OUTER JOIN public.bus_stops t2 ON t1.bus_stop_id = t2.stop_id". Where t1.bus_stop_id properly reflects the annotation:

	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
	@JoinColumn(name="bus_stop_id")
	private BusStops busStop;

Linking to BusStops:

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "bus_stops_seq")
	@SequenceGenerator(name = "bus_stops_seq", sequenceName = "seq_bus_stops")
	@Column(name = "stop_id", columnDefinition = "int4")
	private Integer stopId;

The correct SQL column name in both cases should have been t1.bus_stop_id.

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602776#action_12602776 ] 

Fay Wang commented on OPENJPA-626:
----------------------------------

Can you set a break point in 
(1) AnnotationPersistenceMappingParser:
parseJoinColumns(FieldMapping fm, MappingInfo info,
        boolean secondaryAllowed, JoinColumn... joins) {

        List<Column> cols = new ArrayList<Column>(joins.length);
        int unique = 0;
        String secondary = null;
        for (int i = 0; i < joins.length; i++) {
            cols.add(newColumn(joins[i]));
            unique |= (joins[i].unique()) ? TRUE : FALSE;
            secondary = trackSecondaryTable(fm, secondary,
                joins[i].table(), i);
            if (!secondaryAllowed && secondary != null)
                throw new MetaDataException(_loc.get("bad-second", fm));
        }

        setColumns(fm, info, cols, unique); <==  set break point here and examine whether cols contains "bus_stop_id"


(2) If it does contain "bus_stop_id", can you set a break point in MappingInfo:

    protected ForeignKey createForeignKey(MetaDataContext context,
        String prefix, List given, ForeignKeyDefaults def, Table table,
        ClassMapping cls, ClassMapping rel, boolean inversable, boolean adapt) {
        assertTable(context, table);
        if (prefix == null)                                       <== set a break point here to check if paramenter given contains "bus_stop_id"
            prefix = "generic";

        // collect the foreign key columns and their targets
        Object[][] joins = createJoins(context, prefix, table, cls, rel,
            given, def, inversable, adapt);                                                     <== if it does, set a break point here to see if the resulting joins contains "bus_stop_id"


(3) if it does, set a break point in MappingInfo:
    protected ForeignKey createForeignKey(MetaDataContext context,
        String prefix, List given, ForeignKeyDefaults def, Table table,
        ClassMapping cls, ClassMapping rel, boolean inversable, boolean adapt) {

...

        // add joins to key
        Column col;
        for (int i = 0; i < joins.length; i++) {
            col = (Column) joins[i][0];
            if (joins[i][1]instanceof Column)
                fk.join(col, (Column) joins[i][1]);       <== set a break point here to see if col is "bus_stop_id"
            else if ((joins[i][2] == Boolean.TRUE) != (_join == JOIN_INVERSE))
                fk.joinConstant(joins[i][1], col);
            else
                fk.joinConstant(col, joins[i][1]);
        }


Please let us know if you get "bus_stio_id" in the last step. If so, we will then go from there to debug further. Thanks! 

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Tim Holloway (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602811#action_12602811 ] 

Tim Holloway commented on OPENJPA-626:
--------------------------------------

Per Jeremy Bauer:

Attempted to add 

<property name="openjpa.jdbc.QuerySQLCache" value="false"/>

to persistence.xml. No effect on problem. I'll try Fay Wang's breakpoint suggestions.

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Tim Holloway (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605685#action_12605685 ] 

Tim Holloway commented on OPENJPA-626:
--------------------------------------

Thanks, Fay.

Don't be surprised if you encounter more of these funny columnDefinition's. As far as I can determine, there seems to have been a bug(?) in the earlier OpenJPA releases where columnDefinition was being interpreted as though it was the name= attribute. That stopped working somewhere around release 1.0. I don't know how I ended up using them, but I thought I'd flushed them all out. Obviously not.

Here's the context I'm failing on:

       @Transactional
 	public Trips loadTripStops(Trips editTrip) {
		final Trips trip = entityManager.merge(editTrip);
		@SuppressWarnings("unused")
		List<TripStops> childList = trip.getTripStops();
		return trip;
	}

And here's the latest SQL, after making the repair:

<openjpa-1.2.0-SNAPSHOT-r422266:661817M nonfatal general error> org.apache.openjpa.persistence.PersistenceException: ERROR: column t0.busstops_stop_id does not exist {prepstmnt 27436928 SELECT t0.trip_stop_id, t0.active_stop, t0.arrive_time, t1.stop_id, t1.description, t1.elevation, t1.in_service_date, t1.inbound, t1.latitude, t1.longitude, t1.out_service_date, t1.sheltered, t1.street1_block, t2.street_direction_id, t2.description, t1.street1_name, t1.street1_qualifier, t3.street_type_id, t3.description, t1.street2_block, t4.street_direction_id, t4.description, t1.street2_name, t1.street2_qualifier, t5.street_type_id, t5.description, t1.waypoint, t0.depart_time, t0.end_of_line, t0.inbound, t0.ROUTES_ROUTE_ID FROM public.trip_stops t0 LEFT OUTER JOIN public.bus_stops t1 ON t0.BUSSTOPS_STOP_ID = t1.stop_id LEFT OUTER JOIN public.lk_street_directions t2 ON t1.street1_direction = t2.street_direction_id LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE t0.TRIPS_TRIP_ID = ? ORDER BY t0.arrive_time ASC [params=(int) 11]} [code=0, state=42703]


> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-src-1.zip, OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605672#action_12605672 ] 

Fay Wang commented on OPENJPA-626:
----------------------------------

Hi Tim, I unzipped your source and made a couple of changes in your entity classes so that it can work with my DB2 backend (for example, change int4 to int, remove text column type, etc). I also modified the following entities classes to change "columnDefintion" to "name" in the JoinColumn annotations (without doing so, I won't be able to execute the create table ddl):  
(1)   change 
public class RouteStops {
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
	@JoinColumn(columnDefinition = "bus_stop_id")
	private BusStops busStops;
...
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
	@JoinColumn(name="route_id", columnDefinition = "route_id")
	private Routes routes;

to

public class RouteStops {
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
	@JoinColumn(name = "bus_stop_id")
	private BusStops busStops;
...
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
	@JoinColumn(name="route_id")
	private Routes routes;

(2)  from 
public class Schedules {
...
	@ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
	@JoinColumn(name="route_id", columnDefinition="route_id", nullable=false)
	private Routes routes;

to 

public class Schedules {
...
	@ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
	@JoinColumn(name="route_id", nullable=false)
	private Routes routes;

(3)  from 
 publc class TripStops {
...
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
	@JoinColumn(columnDefinition="stop_id")
	private BusStops busStops;
...

	@ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
	@JoinColumn(columnDefinition="route_id")
	private Routes routes;
...	
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
	@JoinColumn(columnDefinition="trip_id")
	private Trips trips;

to

public class TripStops {
...
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
	@JoinColumn(name="stop_id")
	private BusStops busStops;
...
	@ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
	@JoinColumn(name="route_id")
	private Routes routes;
...
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
	@JoinColumn(name="trip_id")
	private Trips trips;

I then called:

	BusStops b = em.find(BusStops.class, 1);
        ScheduleStops s = em.find(ScheduleStops.class, 1);

The generated SQL are valid in that the there is no synthesized join column name like  t0.BUSSTOP_STOP_ID or  t0.SCHEDULE_SCHEDULE_ID. In the case of  BUSSTOP_STOP_ID, your original annotation in RouteStops  class is 

       @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
	@JoinColumn(columnDefinition = "bus_stop_id")
	private BusStops busStops;

which does not have name field in the JoinColumn annotation. That explains why openjpa constructs a synthenized join column name. You might want to examine your JoinColumn annotations to make sure the name field is properly set. Still I am not clear why your entity class defnitions work fine in openjpa 1.0.x, but fail in openjpa 1.1.x ......







> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-src-1.zip, OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Kevin Sutter (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602755#action_12602755 ] 

Kevin Sutter commented on OPENJPA-626:
--------------------------------------

Still can't reproduce it.  I have been using variations of testcases within our current bucket (AnnoTest2 along with TestManyToMany driver).  I've been experimenting with the names of the join columns, switching between lazy and eager, and even adding the cascade element (even though I doubted this would have any effect).

I am using Derby as my database.  And, I am using the SynchronizeMappings property to automatically create the tables within Derby (part of our normal test environment).  The latter may have an effect here, but I haven't been able to reproduce with or without this property.

I have also run with the complete openjpa TRACE to verify that the actual SQL code generated is accurate.

I have been running in stanard JSE mode (no app server, no Spring, no Tomcat).  Shouldn't make a difference.

My testcase is just doing simple findBy operations, but the type of query shouldn't make a difference either.

Any other ideas?
Kevin

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Updated: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Tim Holloway (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Holloway updated OPENJPA-626:
---------------------------------

    Attachment: OPENJPA-626-src-1.zip

Here's the whole kit and kaboodle. I'm not using a query langauge at all - the failing SQL is generated on attempt to obtain a JPA object that has both eager and lazy fetches/. I think it was  a Schedules object and its children (ScheduleStops) which references BusStops. I can verify that later, if you need.

The original Jira shows the SQL generated from OpenJPA 1.0.2 and OpenJPA 1.1..0. Both are syntactically correct SQL, but the 1.1.0 version fails because it's generating names of columns that don't exist instead of using the explicitly-supplied Column(name=) field names. The false column names are easy to spot, since the generator creates them as all upper-case.

Unless I missed something, both SQL statements are item-by-item identical except for the differing field names at the failure points, and the proper field name is being used in one of the field selections, but not in its corresponding usage in the JOIN. However the other failing field name is in field selection, just to make things more confusing.

Both SQLs are generated from the same source code - all I did was change the version of OpenJPA that Maven linked in. I can flip back and forth at will.



> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-src-1.zip, OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Updated: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Tim Holloway (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Holloway updated OPENJPA-626:
---------------------------------

    Attachment: OPENJPA-626-vars-1.txt

Debug variable dump for annotation and mapping functiond

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604560#action_12604560 ] 

Fay Wang commented on OPENJPA-626:
----------------------------------

Hi Tim, the sql you presented in your last comment is different from the the one that you reported  for this JIRA. It appears that the synthesized join column name is no longer there.  Comparing the  two sqls you reported, schedule_stop_id is a valid column in public.schedule_stops table. I think the last sql you reported should be executed correctly. As to whether you should see bus_stop_id or schedule_stop_id in the sql select fields, I think openjpa will not select the value of the join column (in this case, bus_stop_id) as this column is automatically created by openjpa and internally used for the join purpose only, i.e, there is no correpsonding field in the entity to save this value to.  

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Tim Holloway (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604580#action_12604580 ] 

Tim Holloway commented on OPENJPA-626:
--------------------------------------

Fay, Don't worry about the differences in the SQL overall - this was a snapshot taken midway through and it's therefore incomplete.

However, the original error message fails not on the join, but on the field selection, so I think it accurately reflects the actual problem even though incomplete. It seems to be working correctly on the join.

This is a many-to-one relationship, where multiple scheduleStop objects may all reference a common busStop (foreign key) and the database field that established the linkage is named bus_stop_id. This is the name that the JOIN clause uses, and that's correct. However somehow the actual data retrieval is using the synthesized column name schedule_stop_id instead.

Just as a reminder - this code does work without incident in OpenJPA 1.0.2 and generates the right field names, as demonstrated by the samples listed at the top of this report. It's only the 1.2.0 release where I'm seeing a bad column name.


> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Kevin Sutter (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602754#action_12602754 ] 

Kevin Sutter commented on OPENJPA-626:
--------------------------------------

Some additional comments from Tim (since he doesn't have a JIRA account yet).  These comments came after I asked about any uniqueness with his scenario since we have several testcases that should be verifying the proper action:

As shown, it - and many similar cases - work properly in 1.0.2 and I'm
not doing anything really odd here, but here's a few items that might
have a bearing on it:

1. This is a PostgreSQL database. An earlier version of openJPA had
problems because it tried to get the Java name from an anonymous foreign
key relationship, but PostgreSQL generates names in the form "$1", "$2",
etc, which aren't good Java names. I've tried to ensure that every
foreign relationship has an explicit Java-friendly name, but I might
have missed something.

2. Nothing excessively outrageous about the database structure, but
there are a fair amount of parent-child-grandchild relationships and
some children might have parents of more than one class type. Also a few
1-1 linkages.

3. I'm also tweaking lazy and eager fetches.

4. The model was originally generated by reverse-engineering the
database, but has been extensively hand-modified since then.

5. The failing project is Spring-based running on Tomcat. It's not
impossible that there could be obscure AOP weaver issues.

None of the above should have a direct impact, but I can't vouch for
indirect ones.

You might want to run tests with SQL tracing on and verify that the
names defined in the resulting SQL are actually the names used and it's
not merely 2 wrongs making a right, so to speak.

I can't think of how to reduce my project down to a test case in a
hurry, but I can set some breakpoints in what I've got if you'll suggest
areas that should be looked at.





> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


Re: [jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by Tim Holloway <ti...@mousetech.com>.
Since apparently, it "should" be working and it isn't, is there
someplace downstream I should be checking?

On Thu, 2008-06-05 at 15:56 -0700, Tim Holloway (JIRA) wrote:
> [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602829#action_12602829 ] 
> 
> Tim Holloway commented on OPENJPA-626:
> --------------------------------------
> 
> Long story short - looks like it should be working. I did note some irregularities on the AnnotationPersistenceMappingParser, but they're for other tables and might be undiscovered bad annotations rather than bugs.
> 
> > @JoinColumn with name attribute causes exception on 1.2.0. 
> > -----------------------------------------------------------
> >
> >                 Key: OPENJPA-626
> >                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
> >             Project: OpenJPA
> >          Issue Type: Bug
> >    Affects Versions: 1.2.0
> >            Reporter: Michael Dick
> >         Attachments: OPENJPA-626-vars-1.txt
> >
> >
> > Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> > @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
> >        @JoinColumn(name="bus_stop_id")
> >        private BusStops busStop;
> > Works in release 1.0.2:
> > SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> > t1.in_
> > service_date, t1.inbound, t1.latitude, t1.longitude,
> > t1.out_service_date, t1.sheltered, t1.street1_block,
> > t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> > _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> > t4.street_direction_id, t4.description, t1.street2_name,
> > t1.street2_qualifier, t5.street_type_id, t5.descrip
> > tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> > t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> > t0.schedule_id, t0.stop_sequence, t0.terminu
> > s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> > public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> > public.lk_street_directions t2 ON t1.st
> > reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> > public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> > OUTER JOIN public.lk_street_directions t4 ON t
> > 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> > public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> > t0.schedule_id = ? ORDER BY t0.stop_seque
> > nce ASC [params=(int) 50]
> > Uses synthesized column name instead of declared name in today's CVS
> > snapshot:
> > ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> > SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> > t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> > t1.out_service_date, t1.sheltered, t1.street1_block,
> > t2.street_direction_id, t2.description, t1.street1_name,
> > t1.street1_qualifier, t3.street_type_id, t3.description,
> > t1.street2_block, t4.street_direction_id, t4.description,
> > t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> > t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> > t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> > t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> > t0.transfer_point
> > FROM public.schedule_stops t0
> >  LEFT OUTER JOIN public.bus_stops t1
> >  ON t0.BUSSTOP_STOP_ID = t1.stop_id
> >  LEFT OUTER JOIN public.lk_street_directions t2
> >  ON t1.street1_direction = t2.street_direction_id
> >  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> > t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> > t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> > public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> > t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> > 50]} [code=0, state=42703]
> 


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Tim Holloway (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602829#action_12602829 ] 

Tim Holloway commented on OPENJPA-626:
--------------------------------------

Long story short - looks like it should be working. I did note some irregularities on the AnnotationPersistenceMappingParser, but they're for other tables and might be undiscovered bad annotations rather than bugs.

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605713#action_12605713 ] 

Fay Wang commented on OPENJPA-626:
----------------------------------

Hi Tim, my generated SQL looks fine:

SELECT t0.trip_stop_id, t0.active_stop, t0.arrive_time, t1.stop_id, 
       t1.description, t1.elevation, t1.in_service_date, t1.inbound, 
       t1.latitude, t1.longitude, t1.out_service_date, t1.sheltered, 
       t1.street1_block, t2.street_direction_id, t2.description, 
       t1.street1_name, t1.street1_qualifier, t3.street_type_id, 
       t3.description, t1.street2_block, t4.street_direction_id, 
       t4.description, t1.street2_name, t1.street2_qualifier, 
       t5.street_type_id, t5.description, t1.waypoint, t0.depart_time, 
       t0.end_of_line, t0.inbound, t0.route_id 
FROM public.trip_stops t0 
   LEFT OUTER JOIN public.bus_stops t1 
     ON t0.stop_id = t1.stop_id 
   LEFT OUTER JOIN public.lk_street_directions t2 
     ON t1.street1_direction = t2.street_direction_id 
   LEFT OUTER JOIN public.lk_street_types t3 
     ON t1.street1_type = t3.street_type_id 
   LEFT OUTER JOIN public.lk_street_directions t4 
     ON t1.street2_direction = t4.street_direction_id 
   LEFT OUTER JOIN public.lk_street_types t5 
     ON t1.street2_type = t5.street_type_id 
WHERE t0.trip_id = ? ORDER BY t0.arrive_time ASC  [params=(int) 1]

Since your generated sql still contains synthesized join column name, you might want to check  TripSTops.java to make sure your have "name= " attribute in all the JoinColumn annotation.


> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-src-1.zip, OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605343#action_12605343 ] 

Fay Wang commented on OPENJPA-626:
----------------------------------

Hi Tim, that clarifies some of my consfusions about your second comment on 6/12 ! :=))   So, we are back to your original problem about synthesized join column names. The thing that I am still not clear about is that the sql you reported in your first comment on 6/12 appears to have valid join  column names:

SELECT DISTINCT t0.route_id, t1.schedule_id, t1.schedule_stop_id, t2.stop_id, t2.description, t2.elevation, t2.in_service_date, t2.inbound, t2.latitude, t2.longitude, t2.out_service_date, t2.sheltered, t2.street1_block, t3.street_direction_id, t3.description, t2.street1_name, t2.street1_qualifier, t4.street_type_id, t4.description, t2.street2_block FROM public.schedules t0 LEFT OUTER JOIN public.schedule_stops t1 ON t0.schedule_id = t1.schedule_id LEFT OUTER JOIN public.bus_stops t2 ON t1.bus_stop_id = t2.stop_id LEFT OUTER JOIN public.lk_street_directions t3 ON t2.street1_direction = t3.street_direction_id LEFT OUTER JOIN public.lk_street_types t4 ON t2.street1_type = t4.street_type_id LEFT OUTER JOIN public.lk_street_directions t5 ON t2.street2_direction = t5.street_direction_id ORDER BY t1.schedule_id ASC, t1.stop_sequence ASC 

Do you perform findBy or JPQL? what is the difference between this sql and the one with wrong join column names that you reported for this JIRA? I can help bebugging if you could attach the entity classes that correspond to 
(1) public.bus_stops,  
(2) public.schedule_stops,
(3) public.lk_street_directions,
(4) public.lk_street_types 


  
        

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Tim Holloway (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605982#action_12605982 ] 

Tim Holloway commented on OPENJPA-626:
--------------------------------------

Thanks, Fay. The curse of having too many similar objects with similar names. There were no less than *3* of the little [CENSORED]s still lurking in there. PEBKAC.

Barring surprises, I think that resolves this issue. An enabling bug in the earlier OpenJPA releases made it possible, but that bug is now fixed. I'm now free to see if I can't come up with a way to diagnose inadvertent optimistic locking violations.

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-src-1.zip, OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Tim Holloway (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605090#action_12605090 ] 

Tim Holloway commented on OPENJPA-626:
--------------------------------------

Rats! I got the schedule_stops.schedule_stop_id and the bus_stops.stop_id confused. There is no problem on the field selection after all. It's on the final JOIN, as originally indicated. I noticed that the schedule_stops.schedule_id is rendered incorrectly as SCHEDULE_SCHEDULE_ID (note caps) in BOTH the field selects AND the join.

The stop_id link is an eager fetch. The schedule_id link is a lazy fetch.

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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


[jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0.

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603717#action_12603717 ] 

Fay Wang commented on OPENJPA-626:
----------------------------------

Tim, sorry, I just saw the txt you attached. It appeared that you did see "bus_stop_id" in AnnotationPersistenceMappingParser. Let me take a look at the txt file to see what went wrong.

> @JoinColumn with name attribute causes exception on 1.2.0. 
> -----------------------------------------------------------
>
>                 Key: OPENJPA-626
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-626
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Michael Dick
>         Attachments: OPENJPA-626-vars-1.txt
>
>
> Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : 
> @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
>        @JoinColumn(name="bus_stop_id")
>        private BusStops busStop;
> Works in release 1.0.2:
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_
> service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name, t1.street1
> _qualifier, t3.street_type_id, t3.description, t1.street2_block,
> t4.street_direction_id, t4.description, t1.street2_name,
> t1.street2_qualifier, t5.street_type_id, t5.descrip
> tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.schedule_id, t0.stop_sequence, t0.terminu
> s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN
> public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN
> public.lk_street_directions t2 ON t1.st
> reet1_direction = t2.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT
> OUTER JOIN public.lk_street_directions t4 ON t
> 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.schedule_id = ? ORDER BY t0.stop_seque
> nce ASC [params=(int) 50]
> Uses synthesized column name instead of declared name in today's CVS
> snapshot:
> ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164
> SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation,
> t1.in_service_date, t1.inbound, t1.latitude, t1.longitude,
> t1.out_service_date, t1.sheltered, t1.street1_block,
> t2.street_direction_id, t2.description, t1.street1_name,
> t1.street1_qualifier, t3.street_type_id, t3.description,
> t1.street2_block, t4.street_direction_id, t4.description,
> t1.street2_name, t1.street2_qualifier, t5.street_type_id,
> t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service,
> t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound,
> t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus,
> t0.transfer_point
> FROM public.schedule_stops t0
>  LEFT OUTER JOIN public.bus_stops t1
>  ON t0.BUSSTOP_STOP_ID = t1.stop_id
>  LEFT OUTER JOIN public.lk_street_directions t2
>  ON t1.street1_direction = t2.street_direction_id
>  LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type =
> t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON
> t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN
> public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE
> t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int)
> 50]} [code=0, state=42703]

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