openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fernando Padilla <f...@alum.mit.edu>
Subject can I use Embedded objects in a query?
Date Wed, 22 Oct 2008 06:06:02 GMT
I have an object with an @Embedded sub object (which only contains a 
long as a sub field).  It looks to work just fine, except when I try to 
query the using that field.  You can see from the logs, that the JPQL 
query is OK (with correct parameter), yet the SQL it generates replaces 
the "this.ptTeamId = :p0" with "1 <> 1".  And it seems to do that for 
all queries involving Embedded objects ( of this variety at least )...

Any clues?  help?  hints?  ideas?? :) :)



LOGS:

DEBUG openjpa.Query - Executing query: [select this from 
com.protrade.fandom.data.entities.FbTeam this  where this.ptTeamId = 
:p0] with parameters: {p0=<<TeamId:Team:50306121>>}

DEBUG openjpa.jdbc.SQL - <t 19603027, conn 4242568> executing prepstmnt 
5520452 SELECT t0.JDOID, t0.CREATETIME, t0.AFFILIATION, t0.LEAGUE, 
t0.MASCOT, t0.PTTEAMID FROM FBTEAM t0 WHERE (1 <> 1)







@Entity
@Table(name = "FBTEAM")
public class FbTeam extends HBaseIdCreateTime {
....
@Embedded
@AttributeOverrides( { @AttributeOverride(name = "idLong", column = 
@Column(name = "PTTEAMID")) })
private TeamId ptTeamId;
....
}


@Embeddable
public class TeamId extends BaseProtradeId<Team> {
@Basic
private long idLong;
....
}


Mime
View raw message