Anonymous | Login | Signup for a new account | 12-17-2024 08:37 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0002037 | [Resin] | major | always | 10-03-07 09:15 | 11-07-07 15:18 | ||||
Reporter | westrupp | View Status | public | ||||||
Assigned To | ferg | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | 3.1.3 | ||||||
Summary | 0002037: amber embedded compound pk with many-to-one generates wrong sql | ||||||||
Description |
I have 3 Entity beans: @Entity(name = "User") @Table(name = "APP_USERS") public class User { private Integer userId; private String userName; @Id @Column(name = "USER_ID", nullable = false, length = 22) public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } @Basic @Column(name = "USER_NAME", length = 25) public String getName() { return userName; } private List<Access> accs; @OneToMany(mappedBy = "user") public List<Access> getAccs(){ return accs; } public void setAccs(List<Access> accs) { this.accs = accs; } } @Entity(name = "Application") @Table(name = "WEB_APP") public class Application implements java.io.Serializable { private Integer appId; private String appName; @Id @Column(name = "APP_ID", nullable = false, length = 22) public Integer getAppId() { return appId; } public void setAppId(Integer appId) { this.appId = appId; } @Basic @Column(name = "APP_NAME", nullable = false, length = 100) public String getAppName() { return appName; } public void setAppName(String appName) { this.appName = appName; } } @Entity(name = "Access") @Table(name = "APP_ACCESS") public class Access implements Serializable { private User user; private AccessPK id; public Access(){ } public Access(Integer userId, Integer appId){ this.id = new AccessPK(userId, appId); } @EmbeddedId @AttributeOverrides({ @AttributeOverride(name = "userId", column = @Column(name = "user_id")), @AttributeOverride(name = "appId", column = @Column(name="app_id")) }) public AccessPK getId(){ return this.id; } public void setId(AccessPK id){ this.id=id; } @ManyToOne @JoinColumn(name = "user_id", referencedColumnName = "USER_ID") public User getUser(){ return user; } public void setUser(User user) { this.user = user; } } @Embeddable public class AccessPK implements Serializable { @Column(name = "USER_ID") private Integer userId; @Column(name = "APP_ID") private Integer appId; public AccessPK() { } public AccessPK(Integer userId, Integer appId) { this.userId = userId; this.appId = appId; } public boolean equals(Object o) { if (o instanceof AccessPK) { AccessPK that = (AccessPK) o; return this.userId.equals(that.userId) && this.appId.equals(that.appId); } else { return false; } } public int hashCode() { return userId.hashCode() + appId.hashCode(); } public String toString(){ return "User id: " + this.userId + ", Application id: " + this.appId; } } When i try execute user.getAccs() i get SQLException ORA-00936: Missing Expression. logs: [2007-10-03 18:08:04.525] jdbc/bscs.1.48:prepareStatement(select , c.user_id from APP_USERS o, APP_ACCESS c where (c.user_id = o.USER_ID) and (o.USER_ID = ?),type=1003,concurrency=1007) [2007-10-03 18:08:04.526] jdbc/bscs.1.48:clearParameters() [2007-10-03 18:08:04.526] jdbc/bscs.1.48:setInt(1,8595) [2007-10-03 18:08:04.526] jdbc/bscs.1.48:executeQuery(select , c.user_id from APP_USERS o, APP_ACCESS c where (c.user_id = o.USER_ID) and (o.USER_ID = ?)) [2007-10-03 18:08:04.536] jdbc/bscs.1.48:exn-executeQuery(java.sql.SQLException : ORA-00936: Missing Expression |
||||||||
Additional Information | |||||||||
Attached Files | |||||||||
|
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
33 total queries executed. 28 unique queries executed. |