FAQ
Using 3.0.2 on Mac OS 10.5.8 and java6.

After updating my map.xml with some new entities and some altered
columns at least one of my custom types stops working. For example,
I have an ObjEntity with 2 attributes of the same DB type (bigint) that
should be converted to an object essentially using MyObject.valueOf. The
first attribute gets converted but the second does not. Other
ObjEntities with a similarly defined column also do not get converted
using the custom type mechanism.

Ultimately I end up getting a ClassCastException from readProperty
Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast
to com....
at com....(_....java:32)
at com....(....java:138)


If I revert the map.xml to the previous version via SCM then those
custom types start working again.

Anyone seen anything like this before?

This has happened to me before before saving saving saving has made it
go away but not this time...

Search Discussions

  • Andrus Adamchik at Jul 19, 2012 at 6:58 am
    Hi Arturo,

    could you possibly provide a diff between old and new DataMap? Also is custom type used for a PK column by any chance? (this shouldn't be a problem, I am just collecting clues). Finally, have you tried it with Cayenne 3.1?

    Thnaks,
    Andrus
    On Jul 19, 2012, at 4:51 AM, Arturo Perez wrote:

    Using 3.0.2 on Mac OS 10.5.8 and java6.

    After updating my map.xml with some new entities and some altered
    columns at least one of my custom types stops working. For example,
    I have an ObjEntity with 2 attributes of the same DB type (bigint) that
    should be converted to an object essentially using MyObject.valueOf. The
    first attribute gets converted but the second does not. Other
    ObjEntities with a similarly defined column also do not get converted
    using the custom type mechanism.

    Ultimately I end up getting a ClassCastException from readProperty
    Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast
    to com....
    at com....(_....java:32)
    at com....(....java:138)


    If I revert the map.xml to the previous version via SCM then those
    custom types start working again.

    Anyone seen anything like this before?

    This has happened to me before before saving saving saving has made it
    go away but not this time...
  • Arturo Perez at Jul 19, 2012 at 12:25 pm
    Well, I ended up throwing away the old map and reengineering** the DB
    from scratch. But I did save the broken map and I attached a diff
    between the broken one and the new, working one. The diff was created
    via
    diff goodNewMap.xml badOldMap.xml.

    For some columns the custom type is a PK but it also fails for when the
    column is neither a PK nor an FK.

    Haven't tried with 3.1. Don't want the disruption while I finish up my
    project/sprint. Or is it a seamless upgrade?

    **I use a lot of database domain types so that I can keep track of
    exactly what that VARCHAR column really is. Any way to teach modeler
    how to handle those?

    In article <B743A36C-840E-47F8-B6EF-697887DB315E@objectstyle.org>,
    Andrus Adamchik wrote:
    Hi Arturo,

    could you possibly provide a diff between old and new DataMap? Also is custom
    type used for a PK column by any chance? (this shouldn't be a problem, I am
    just collecting clues). Finally, have you tried it with Cayenne 3.1?

    Thnaks,
    Andrus
    On Jul 19, 2012, at 4:51 AM, Arturo Perez wrote:

    Using 3.0.2 on Mac OS 10.5.8 and java6.

    After updating my map.xml with some new entities and some altered
    columns at least one of my custom types stops working. For example,
    I have an ObjEntity with 2 attributes of the same DB type (bigint) that
    should be converted to an object essentially using MyObject.valueOf. The
    first attribute gets converted but the second does not. Other
    ObjEntities with a similarly defined column also do not get converted
    using the custom type mechanism.

    Ultimately I end up getting a ClassCastException from readProperty
    Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast
    to com....
    at com....(_....java:32)
    at com....(....java:138)


    If I revert the map.xml to the previous version via SCM then those
    custom types start working again.

    Anyone seen anything like this before?

    This has happened to me before before saving saving saving has made it
    go away but not this time...
    begin 644 good-to-broken.diff
    M,S1C,S0*/"`)"3QD8BUA='1R:6)U=&4@;F%M93TB979E;G1?<V5Q(B!T>7!E
    M/2)"24=)3E0B(&ES4')I;6%R>4ME>3TB=')U92(@:7--86YD871O<GD](G1R
    M=64B(&QE;F=T:#TB,3DB+SX*+2TM"CX@"0D\9&(M871T<FEB=71E(&YA;64]
    M(F5V96YT7W-E(G1R=64B
    M(&ES36%N9&%T;W)Y/2)T(M871T
    M<FEB=71E(&YA;64](F-O;6UE;G1?:60B('1Y<&4](DE.5$5'15(B(&ES4')I
    M;6%R>4ME>3TB=')U92(@:7--86YD871O<GD](G1R=64B(&QE;F=T:#TB,C$T
    M-S0X,S8T-R(O/@H\(`D)/&1B+6%T=')I8G5T92!N86UE/2)D=65N;U]C;VUM
    M96YT(B!T>7!E/2)605)#2$%2(B!I<TUA;F1A=&]R>3TB=')U92(@;&5N9W1H
    M/2(R,30W-#@S-C0W(B\^"BTM+0H^(`D)/&1B+6%T=')I8G5T92!N86UE/2)C
    M;VUM96YT7VED(B!T>7!E/2))3E1%1T52(B!I<U!R:6UA<GE+97D](G1R=64B
    M(&ES36%N9&%T;W)Y/2)T(&YA;64]
    M(F1U96YO7V-O;6UE;G0B('1Y<&4](E9!4D-(05(B(&ES36%N9&%T;W)Y/2)T
    M(O/@HW-V,W-PH\(`D)/&1B+6%T=')I8G5T92!N
    M86UE/2)W:&5N7W5P9&%T960B('1Y<&4](E1)34535$%-4"(@:7--86YD871O
    M(M871T<FEB=71E
    M(&YA;64](G=H96Y?=7!D871E9"(@='EP93TB5$E-15-404U0(B!I<TUA;F1A
    M=&]R>3TB=')U92(O/@HY,&,Y,`H\(`D)/&1B+6%T=')I8G5T92!N86UE/2)I
    M;G9I=&5?8V]D92(@='EP93TB5D%20TA!4B(@:7-0<FEM87)Y2V5Y/2)T<G5E
    M(B!I(R,30W-#@S-C0W(B\^"BTM
    M+0H^(`D)/&1B+6%T=')I8G5T92!N86UE/2)I;G9I=&5?8V]D92(@='EP93TB
    M5D%20TA!4B(@:7--86YD871O<GD](G1R=64B(&QE;F=T:#TB,C$T-S0X,S8T
    M-R(O/@HQ,#5C,3`U"CP@"0D\9&(M871T<FEB=71E(&YA;64](G=H96Y?8W)E
    M871E9"(@='EP93TB5$E-15-404U0(B!I<TUA;F1A=&]R>3TB=')U92(@;&5N
    M9W1H/2(R.2(O/@HM+2T*/B`)"3QD8BUA='1R:6)U=&4@;F%M93TB=VAE;E]C
    M<F5A=&5D(B!T>7!E/2)424U%4U1!35`B(&ES36%N9&%T;W)Y/2)T<G5E(B\^
    M"C$Q,V,Q,3,*/"`)"3QD8BUA='1R:6)U=&4@;F%M93TB9'5E;F]?:60B('1Y
    M<&4](DE.5$5'15(B(&ES4')I;6%R>4ME>3TB=')U92(@:7--86YD871O<GD]
    M(G1R=64B(&QE;F=T:#TB,C$T-S0X,S8T-R(O/@HM+2T*/B`)"3QD8BUA='1R
    M:6)U=&4@;F%M93TB9'5E;F]?:60B('1Y<&4](E9!4D-(05(B(&ES4')I;6%R
    M>4ME>3TB=')U92(@:7--86YD871O<GD](G1R=64B(&QE;F=T:#TB,C$T-S0X
    M,S8T-R(O/@HQ-#9C,30V"CP@"0D\9&(M871T<FEB=71E(&YA;64](F-H86YN
    M96PB('1Y(&QE;F=T:#TB
    M,C$T-S0X,S8T-R(O/@HM+2T*/B`)"3QD8BUA='1R:6)U=&4@;F%M93TB8VAA
    M;FYE;"(@='EP93TB0DE'24Y4(B!I<TUA;F1A=&]R>3TB=')U92(O/@HQ-3-C
    M,34S"CP@"0D\9&(M871T<FEB=71E(&YA;64](G)E8VEP:65N=%]D=65N;R(@
    M='EP93TB24Y414=%4B(@:7--86YD871O<GD](G1R=64B(&QE;F=T:#TB,C$T
    M-S0X,S8T-R(O/@HM+2T*/B`)"3QD8BUA='1R:6)U=&4@;F%M93TB<F5C:7!I
    M96YT7V1U96YO(B!T>7!E/2)605)#2$%2(B!I<TUA;F1A=&]R>3TB=')U92(@
    M;&5N9W1H/2(R,30W-#@S-C0W(B\^"C$V,6,Q-C$*/"`)"3QD8BUA='1R:6)U
    M=&4@;F%M93TB97-T:6UA=&5D7W!R:6-E(B!T>7!E/2))3E1%1T52(B!I<TUA
    M;F1A=&]R>3TB=')U92(@;&5N9W1H/2(R,30W-#@S-C0W(B\^"BTM+0H^(`D)
    M/&1B+6%T=')I8G5T92!N86UE/2)E<W1I;6%T961?<')I8V4B('1Y<&4](E9!
    M4D-(05(B(&ES36%N9&%T;W)Y/2)T(Q-#<T.#,V-#<B
    M+SX*,S(W83,R."PS,S`*/B`)/&1B+7)E;&%T:6]N<VAI<"!N86UE/2)T;TEN
    M=&5R97-T:6YG0VAA;FYE;$%R<F%Y(B!S;W5R8V4](F-A;F]N:6-A;%]U<FPB
    M('1A(CX*/B`)
    M"3QD8BUA='1R:6)U=&4M<&%I<B!S;W5R8V4](F-H86YN96PB('1A<F=E=#TB
    M;&ES=&5N:6YG7V-H86YN96PB+SX*/B`)/"]D8BUR96QA=&EO;G-H:7`^"C,U
    M,F,S-34*/"`)/&1B+7)E;&%T:6]N<VAI<"!N86UE/2)C;VUM96YT0V%N;VYI
    M8V%L57)L07)R87DB('-O=7)C93TB9'5E;F\B('1A<F=E=#TB8V]M;65N=%]C
    M86YO;FEC86Q?=7)L(B!T;TUA;GD](G1R=64B/@HM+2T*/B`)/&1B+7)E;&%T
    M:6]N<VAI<"!N86UE/2)C86YO;FEC86Q5<FQ#;VUM96YT07)R87DB('-O=7)C
    M93TB9'5E;F\B('1A<F=E=#TB8V]M;65N=%]C86YO;FEC86Q?=7)L(B!T;TUA
    M;GD](G1R=64B/@HS.#)C,S@U"CP@"3QD8BUR96QA=&EO;G-H:7`@;F%M93TB
    M9VEF=$-O;G1R:6)U=&]R07)R87DB('-O=7)C93TB9'5E;F\B('1A<F=E=#TB
    M9VEF=%]C;VYT(@=&]-86YY
    M/2)T<G5E(CX*+2TM"CX@"3QD8BUR96QA=&EO;G-H:7`@;F%M93TB9VEF=$-O
    M;G1R:6)U=&EO;D%R<F%Y(B!S;W5R8V4](F1U96YO(B!T87)G970](F=I9G1?
    M8V]N=')I8G5T;W(B('1O1&5P96YD96YT4$L](G1R=64B('1O36%N>3TB=')U
    M92(^"C,Y-&,S.3<*/"`)/&1B+7)E;&%T:6]N<VAI<"!N86UE/2)D=65N;U5R
    M;$QI<W1$97-I<F5D57)L07)R87DB('-O=7)C93TB9'5E;F]?9&5S:7)E9%]U
    M<FPB('1A<F=E=#TB9'5E;F]?=7)L7VQI<W1?9&5S:7)E9%]U<FPB('1O1&5P
    M96YD96YT4$L](G1R=64B('1O36%N>3TB=')U92(^"BTM+0H^(`D\9&(M<F5L
    M871I;VYS:&EP(&YA;64](F1U96YO57)L3&ES=$%R<F%Y(B!S;W5R8V4](F1U
    M96YO7V1E<VER961?=7)L(B!T87)G970](F1U96YO7W5R;%]L:7-T7V1E<VER
    M961?=7)L(B!T;T1E<&5N9&5N=%!+/2)T<G5E(B!T;TUA;GD](G1R=64B/@HT
    M,S9C-#,Y"CP@"3QD8BUR96QA=&EO;G-H:7`@;F%M93TB9'5E;F]5<FQ,:7-T
    M1&5S:7)E9%5R;$%R<F%Y(B!S;W5R8V4](F1U96YO7W5R;%]L:7-T(B!T87)G
    M970](F1U96YO7W5R;%]L:7-T7V1E<VER961?=7)L(B!T;T1E<&5N9&5N=%!+
    M/2)T<G5E(B!T;TUA;GD](G1R=64B/@HM+2T*/B`)/&1B+7)E;&%T:6]N<VAI
    M<"!N86UE/2)D=65N;U5R;$QI<W1!<G)A>2(@<V]U<F-E/2)D=65N;U]U<FQ?
    M;&ES="(@=&%R9V5T/2)D=65N;U]U<FQ?;&ES=%]D97-I<F5D7W5R;"(@=&]$
    M97!E;F1E;G102STB=')U92(@=&]-86YY/2)T<G5E(CX*-3$Q834Q-0H^(`D\
    M;V)J+7)E;&%T:6]N<VAI<"!N86UE/2)T;TEN=&5R97-T:6YG0VAA;FYE;$%R
    M<F%Y(B!S;W5R8V4](D-A;F]N:6-A;%5R;"(@=&%R9V5T/2)#:&%N;F5L26YT
    M97)E<W0B(&1E;&5T95)U;&4](D1E;GDB(&1B+7)E;&%T:6]N<VAI<"UP871H
    M/2)T;TEN=&5R97-T:6YG0VAA;FYE;$%R<F%Y(B\^"C4R,&,U,C0*/"`)/&]B
    M:BUR96QA=&EO;G-H:7`@;F%M93TB8V]M;65N=$-A;F]N:6-A;%5R;$%R<F%Y
    M(B!S;W5R8V4](D1U96YO(B!T87)G970](D-O;6UE;G1#86YO;FEC86Q5<FPB
    M(&1E;&5T95)U;&4](D1E;GDB(&1B+7)E;&%T:6]N<VAI<"UP871H/2)C;VUM
    M96YT0V%N;VYI8V%L57)L07)R87DB+SX*+2TM"CX@"3QO8FHM<F5L871I;VYS
    M:&EP(&YA;64](F-O;6UE;G1#86YO;FEC86Q5<FQ!<G)A>2(@<V]U<F-E/2)$
    M=65N;R(@=&%R9V5T/2)#;VUM96YT0V%N;VYI8V%L57)L(B!D96QE=&52=6QE
    M/2)$96YY(B!D8BUR96QA=&EO;G-H:7`M<&%T:#TB8V%N;VYI8V%L57)L0V]M
    M;65N=$%R<F%Y(B\^"C4R,F0U,C4*/"`)/&]B:BUR96QA=&EO;G-H:7`@;F%M
    M93TB9'5E;F]);G9I=&5!(@=&%R9V5T/2)$
    M=65N;TEN=FET92(@9&5L971E4G5L93TB1&5N>2(@9&(M<F5L871I;VYS:&EP
    M+7!A=&@](F1U96YO26YV:71E07)R87DB+SX*-3,P8S4S,PH\(`D\;V)J+7)E
    M;&%T:6]N<VAI<"!N86UE/2)G:69T0V]N=')I8G5T;W)!<G)A>2(@<V]U<F-E
    M/2)$=65N;R(@=&%R9V5T/2)':69T0V]N=')I8G5T;W(B(&1E;&5T95)U;&4]
    M(D1E;GDB(&1B+7)E;&%T:6]N<VAI<"UP871H/2)G:69T0V]N=')I8G5T;W)!
    M<G)A>2(O/@HM+2T*/B`)/&]B:BUR96QA=&EO;G-H:7`@;F%M93TB9VEF=$-O
    M;G1R:6)U=&EO;D%R<F%Y(B!S;W5R8V4](D1U96YO(B!T87)G970](D=I9G1#
    M;VYT(@9&(M<F5L871I;VYS:&EP
    M+7!A=&@](F=I9G1#;VYT(L-3,S8S4S-2PU
    M,S@*/"`)/&]B:BUR96QA=&EO;G-H:7`@;F%M93TB=&]$=65N;R(@<V]U<F-E
    M/2)$=65N;R(@=&%R9V5T/2)$=65N;TQO8VLB(&1E;&5T95)U;&4](DYU;&QI
    M9GDB(&1B+7)E;&%T:6]N(`D\
    M;V)J+7)E;&%T:6]N<VAI<"!N86UE/2)D=65N;U5R;$QI<W1$97-I<F5D57)L
    M07)R87DB('-O=7)C93TB1'5E;F]$97-I<F5D57)L(B!T87)G970](D1U96YO
    M57)L3&ES=$1E<VER9615<FPB(&1E;&5T95)U;&4](D1E;GDB(&1B+7)E;&%T
    M:6]N<VAI<"UP871H/2)D=65N;U5R;$QI<W1$97-I<F5D57)L07)R87DB+SX*
    M+2TM"CX@"3QO8FHM<F5L871I;VYS:&EP(&YA;64](F=I9G1296-I<&EE;G1!
    M(@=&%R9V5T/2)':69T4')O<&]S86PB(&1E
    M;&5T95)U;&4](D1E;GDB(&1B+7)E;&%T:6]N<VAI<"UP871H/2)G:69T4F5C
    M:7!I96YT07)R87DB+SX*/B`)/&]B:BUR96QA=&EO;G-H:7`@;F%M93TB=&]$
    M=65N;TEN=FET94%R<F%Y(B!S;W5R8V4](D1U96YO(B!T87)G970](D1U96YO
    M26YV:71E(B!D96QE=&52=6QE/2)$96YY(B!D8BUR96QA=&EO;G-H:7`M<&%T
    M:#TB9'5E;F]);G9I=&5!(`D\;V)J+7)E;&%T:6]N<VAI<"!N
    M86UE/2)T;T1U96YO3&]C:R(@<V]U<F-E/2)$=65N;R(@=&%R9V5T/2)$=65N
    M;TQO8VLB(&1E;&5T95)U;&4](D-A<V-A9&4B(&1B+7)E;&%T:6]N<VAI<"UP
    M871H/2)T;T1U96YO3&]C:R(O/@H^(`D\;V)J+7)E;&%T:6]N<VAI<"!N86UE
    M/2)D=65N;U5R;$QI<W1!<G)A>2(@<V]U<F-E/2)$=65N;T1E<VER9615<FPB
    M('1A<F=E=#TB1'5E;F]5<FQ,:7-T1&5S:7)E9%5R;"(@9&5L971E4G5L93TB
    M1&5N>2(@9&(M(F1U96YO57)L3&ES=$%R<F%Y
    M(B\^"C4S-60U,SD*/"`)/&]B:BUR96QA=&EO;G-H:7`@;F%M93TB9VEF=%!R
    M;W!O<V%L271E;4%R<F%Y(B!S;W5R8V4](D1U96YO1&5S:7)E9%5R;"(@=&%R
    M9V5T/2)':69T4')O<&]S86Q)=&5M(B!D96QE=&52=6QE/2)$96YY(B!D8BUR
    M96QA=&EO;G-H:7`M<&%T:#TB9VEF=%!R;W!O<V%L271E;4%R<F%Y(B\^"C4T
    M-V,U-3$*/"`)/&]B:BUR96QA=&EO;G-H:7`@;F%M93TB9'5E;F]5<FQ,:7-T
    M1&5S:7)E9%5R;$%R<F%Y(B!S;W5R8V4](D1U96YO57)L3&ES="(@=&%R9V5T
    M/2)$=65N;U5R;$QI<W1$97-I<F5D57)L(B!D96QE=&52=6QE/2)$96YY(B!D
    M8BUR96QA=&EO;G-H:7`M<&%T:#TB9'5E;F]5<FQ,:7-T1&5S:7)E9%5R;$%R
    M<F%Y(B\^"BTM+0H^(`D\;V)J+7)E;&%T:6]N<VAI<"!N86UE/2)D=65N;U5R
    M;$QI('1A<F=E=#TB1'5E
    M;F]5(@9&(M<F5L
    E871I;VYS:&EP+7!A=&@](F1U96YO57)L3&ES=$%R<F%Y(B\^"@==
    `
    end
  • Andrus Adamchik at Jul 19, 2012 at 1:15 pm

    On Jul 19, 2012, at 3:24 PM, Arturo Perez wrote:

    diff goodNewMap.xml badOldMap.xml.
    So does goodNewMap.xml exhibit the problem with custom types or badOldMap.xml? Sorry, a bit confused here. Also in the diff could you tell me the names of the columns that are causing you grief?
    Haven't tried with 3.1. Don't want the disruption while I finish up my
    project/sprint. Or is it a seamless upgrade?
    Persistence API is 99% compatible (1% is removed deprecated methods). The biggest change is configuration. The way Cayenne is bootstrapped was rewritten from scratch. So yeah, this will not be completely transparent.
    **I use a lot of database domain types so that I can keep track of
    exactly what that VARCHAR column really is. Any way to teach modeler
    how to handle those?
    Modeler or runtime? Runtime should just work (aside from the possibility of some buggy code).

    Andrus
  • Arturo Perez at Jul 20, 2012 at 12:49 am
    In article <E5037A45-4CCD-4845-9A90-3767BA1E04FD@objectstyle.org>,
    Andrus Adamchik wrote:
    On Jul 19, 2012, at 3:24 PM, Arturo Perez wrote:

    diff goodNewMap.xml badOldMap.xml.
    So does goodNewMap.xml exhibit the problem with custom types or
    badOldMap.xml? Sorry, a bit confused here. Also in the diff could you tell me
    the names of the columns that are causing you grief?
    badoldMap doesn't work with custom types. The column causing trouble is
    channel or channel_id.
    Haven't tried with 3.1. Don't want the disruption while I finish up my
    project/sprint. Or is it a seamless upgrade?
    Persistence API is 99% compatible (1% is removed deprecated methods). The
    biggest change is configuration. The way Cayenne is bootstrapped was
    rewritten from scratch. So yeah, this will not be completely transparent.
    **I use a lot of database domain types so that I can keep track of
    exactly what that VARCHAR column really is. Any way to teach modeler
    how to handle those?
    Modeler or runtime? Runtime should just work (aside from the possibility of
    some buggy code).
    Modeler. The runtime is awesome with domain types but having to go into
    each entity and fix the column type is really tedious.
    Andrus
    thanks!
  • Andrus Adamchik at Jul 22, 2012 at 9:29 am
    Just moved it to "Custom types in PKs and relationships" thread. Let's discuss it there.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedJul 19, '12 at 1:55a
activeJul 22, '12 at 9:29a
posts6
users2
websitecayenne.apache.org

2 users in discussion

Arturo Perez: 3 posts Andrus Adamchik: 3 posts

People

Translate

site design / logo © 2022 Grokbase