-
1. Re: composed primkey, ejbSelect ... where, condition faills
aloubyansky Jun 23, 2004 4:10 AM (in response to franklemke)Is it 3.2.4? I don't think the problem is actorPK being also a foreign key. Can you enable TRACE logging for org.jboss.ejb.plugins.cmp and see what query is executed and what parameters are set?
-
2. Re: composed primkey, ejbSelect ... where, condition faills
franklemke Jun 23, 2004 6:51 AM (in response to franklemke)No, it is 3.2.2. I Post you some more details, which are not 100%
compatible to my first posting, since I changed and tried a lot....
The phenomen is:
1.) When I deploy the beans and run the client, the bean Akteur returns
allways the Brief-bean, which the client wants first (see bold
paramerters in client-code).
2.) When I change the first bold marked parameter in the client-Code, the
Atkeur-bean still returns the same as it did under 1.).
3.) Untill I undeployed and then redeployed the beans, the Atkeur-bean will
allwas return the Brief-bean, that fits the new first parameter, changed
under 2.)
Here are some logs (for 1.) and 3.) ):--------------------
12:32:22,752 INFO [STDOUT] TryRemote -----> : ejbSelectAngebot(admin, Linde, 1);
12:32:23,918 DEBUG [Akteur#ejbSelectAngebot] Executing SQL: SELECT DISTINCT t0_o.nameAkteurPK, t0_o.nameAktienGesellschaftPK, t0_o.skrontoNrPK FROM Brief t0_o WHERE (t0_o.nameAkteurPK = ? AND t0_o.nameAktienGesellschaftPK = ? AND t0_o.skrontoNrPK = ?)
12:33:24,623 INFO [STDOUT] TryRemote -----> : ejbSelectAngebot(admin, MAN, 1);
12:33:25,783 DEBUG [Akteur#ejbSelectAngebot] Executing SQL: SELECT DISTINCT t0_o.nameAkteurPK, t0_o.nameAktienGesellschaftPK, t0_o.skrontoNrPK FROM Brief t0_o WHERE (t0_o.nameAkteurPK = ? AND t0_o.nameAktienGesellschaftPK = ? AND t0_o.skrontoNrPK = ?)
The Results:-----------------------
Akteur=admin, AG=Linde, SkrontoNr=1, Menge=3, Preis=3
Akteur=admin, AG=Linde, SkrontoNr=1, Menge=3, Preis=3
The Coding:-----------------------
AkteurBean:public String getAngebotRemote(String nameAG, int skrontoNr) { String nameAkteur = getNamePK(); BriefLocal brief; Set s; try { System.out.println("TryRemote -----> : ejbSelectAngebot("+getNamePK()+", "+nameAG+", "+skrontoNr+");"); s = ejbSelectAngebot(getNamePK(), nameAG, skrontoNr); brief = (BriefLocal) s.iterator().next(); String x = "Akteur="+brief.getNameAkteurPK() + ", AG="+brief.getNameAktienGesellschaftPK()+ ", SkrontoNr="+brief.getSkrontoNrPK()+ ", Menge="+brief.getAngebotsMenge()+ ", Preis="+brief.getPreisMin(); return x; } catch (Exception e) { System.out.println("Fehler -----> : ejbSelectAngebot("+ nameAG +");"); e.printStackTrace(); return null; } } /** * @ejb.select query = "select object(o) from Brief o where o.nameAkteurPK=?1 and o.nameAktienGesellschaftPK=?2 and o.skrontoNrPK=?3" */ public abstract Set ejbSelectAngebot(String nameAkteur, String nameAG, int skrontoNr) throws FinderException;
Client-Codepublic static void main(String[] args) throws Exception { AkteurHome akteurHome; Akteur akteur; Brief brief; Context initial = new InitialContext(); Object objref = initial.lookup("ejb/bp/AkteurRemote"); akteurHome = (AkteurHome) PortableRemoteObject.narrow(objref, AkteurHome.class); akteur = akteurHome.findByPrimaryKey("admin"); String x = akteur.getAngebotRemote("Linde", 1); System.out.println(x); x = akteur.getAngebotRemote("MAN", 1); System.out.println(x); }
Regards,
Frank -
3. Re: composed primkey, ejbSelect ... where, condition faills
aloubyansky Jun 24, 2004 3:08 AM (in response to franklemke)Ok, enable TRACE logging for CMP to see the parameters.
Also post hashCode() and equals() implementations of the pk class. -
4. Re: composed primkey, ejbSelect ... where, condition faills
franklemke Jun 24, 2004 12:37 PM (in response to franklemke)Okay:
Output from Console:
18:18:05,223 DEBUG [Akteur#findByPrimaryKey] Executing SQL: SELECT namePK FROM Akteur WHERE namePK=?
18:18:05,312 DEBUG [Akteur] Executing SQL: SELECT passwort, rolle, gruppe FROM Akteur WHERE (namePK=?)
18:18:05,339 INFO [STDOUT] TryRemote -----> : ejbSelectAngebot(admin, Linde, 1);
18:18:05,344 DEBUG [Akteur#ejbSelectAngebot] Executing SQL: SELECT DISTINCT t0_o.nameAkteurPK, t0_o.nameAktienGesellschaftPK, t0_o.skrontoNrPK FROM Brief t0_o WHERE (t0_o.nameAkteurPK = ? AND t0_o.nameAktienGesellschaftPK = ? AND t0_o.skrontoNrPK = ?)
18:18:05,351 DEBUG [Brief] Executing SQL: SELECT preisMin, angebotsMenge, zeitpunkt FROM Brief WHERE (nameAkteurPK=? AND nameAktienGesellschaftPK=? AND skrontoNrPK=?)
18:18:05,386 DEBUG [Akteur#findByPrimaryKey] Executing SQL: SELECT namePK FROM Akteur WHERE namePK=?
18:18:05,397 DEBUG [Akteur] Executing SQL: SELECT passwort, rolle, gruppe FROM Akteur WHERE (namePK=?)
18:18:05,398 INFO [STDOUT] TryRemote -----> : ejbSelectAngebot(admin, MAN, 1);
18:18:05,399 DEBUG [Akteur#ejbSelectAngebot] Executing SQL: SELECT DISTINCT t0_o.nameAkteurPK, t0_o.nameAktienGesellschaftPK, t0_o.skrontoNrPK FROM Brief t0_o WHERE (t0_o.nameAkteurPK = ? AND t0_o.nameAktienGesellschaftPK = ? AND t0_o.skrontoNrPK = ?)
18:18:05,401 DEBUG [Brief] Executing SQL: SELECT preisMin, angebotsMenge, zeitpunkt FROM Brief WHERE (nameAkteurPK=? AND nameAktienGesellschaftPK=? AND skrontoNrPK=?)
Trace:
2004-06-24 18:18:05,223 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Akteur#findByPrimaryKey] Executing SQL: SELECT namePK FROM Akteur WHERE namePK=?
2004-06-24 18:18:05,226 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Akteur#findByPrimaryKey] Set parameter: index=1, jdbcType=VARCHAR, value=admin
2004-06-24 18:18:05,300 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.Akteur] RESET PERSISTENCE CONTEXT: id=admin
2004-06-24 18:18:05,304 TRACE [org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.Akteur] load data: entity=Akteur pk=admin
2004-06-24 18:18:05,307 TRACE [org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.Akteur] No preload data found: entity=Akteur pk=admin
2004-06-24 18:18:05,312 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Akteur] Default eager-load for entity: readahead=null
2004-06-24 18:18:05,312 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Akteur] Executing SQL: SELECT passwort, rolle, gruppe FROM Akteur WHERE (namePK=?)
2004-06-24 18:18:05,313 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Akteur#namePK] Set parameter: index=1, jdbcType=VARCHAR, value=admin
2004-06-24 18:18:05,339 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.Akteur] Store command NOT executed. Entity is not dirty: pk=admin
2004-06-24 18:18:05,344 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Akteur#ejbSelectAngebot] Executing SQL: SELECT DISTINCT t0_o.nameAkteurPK, t0_o.nameAktienGesellschaftPK, t0_o.skrontoNrPK FROM Brief t0_o WHERE (t0_o.nameAkteurPK = ? AND t0_o.nameAktienGesellschaftPK = ? AND t0_o.skrontoNrPK = ?)
2004-06-24 18:18:05,345 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Akteur#ejbSelectAngebot] Set parameter: index=1, jdbcType=VARCHAR, value=admin
2004-06-24 18:18:05,345 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Akteur#ejbSelectAngebot] Set parameter: index=2, jdbcType=VARCHAR, value=Linde
2004-06-24 18:18:05,345 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Akteur#ejbSelectAngebot] Set parameter: index=3, jdbcType=INTEGER, value=1
2004-06-24 18:18:05,349 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.Brief] RESET PERSISTENCE CONTEXT: id=[.null.null.0.]
2004-06-24 18:18:05,349 TRACE [org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.Brief] load data: entity=Brief pk=[.null.null.0.]
2004-06-24 18:18:05,351 TRACE [org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.Brief] No preload data found: entity=Brief pk=[.null.null.0.]
2004-06-24 18:18:05,351 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Brief] Default eager-load for entity: readahead=null
2004-06-24 18:18:05,351 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Brief] Executing SQL: SELECT preisMin, angebotsMenge, zeitpunkt FROM Brief WHERE (nameAkteurPK=? AND nameAktienGesellschaftPK=? AND skrontoNrPK=?)
2004-06-24 18:18:05,351 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Brief#nameAkteurPK] Set parameter: index=1, jdbcType=VARCHAR, value=admin
2004-06-24 18:18:05,352 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Brief#nameAktienGesellschaftPK] Set parameter: index=2, jdbcType=VARCHAR, value=Linde
2004-06-24 18:18:05,352 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Brief#skrontoNrPK] Set parameter: index=3, jdbcType=INTEGER, value=1
2004-06-24 18:18:05,357 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.Brief] Store command NOT executed. Entity is not dirty: pk=[.null.null.0.]
2004-06-24 18:18:05,357 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.Akteur] Store command NOT executed. Entity is not dirty: pk=admin
2004-06-24 18:18:05,386 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Akteur#findByPrimaryKey] Executing SQL: SELECT namePK FROM Akteur WHERE namePK=?
2004-06-24 18:18:05,386 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Akteur#findByPrimaryKey] Set parameter: index=1, jdbcType=VARCHAR, value=admin
2004-06-24 18:18:05,396 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.Akteur] RESET PERSISTENCE CONTEXT: id=admin
2004-06-24 18:18:05,396 TRACE [org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.Akteur] load data: entity=Akteur pk=admin
2004-06-24 18:18:05,397 TRACE [org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.Akteur] No preload data found: entity=Akteur pk=admin
2004-06-24 18:18:05,397 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Akteur] Default eager-load for entity: readahead=null
2004-06-24 18:18:05,397 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Akteur] Executing SQL: SELECT passwort, rolle, gruppe FROM Akteur WHERE (namePK=?)
2004-06-24 18:18:05,397 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Akteur#namePK] Set parameter: index=1, jdbcType=VARCHAR, value=admin
2004-06-24 18:18:05,399 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.Akteur] Store command NOT executed. Entity is not dirty: pk=admin
2004-06-24 18:18:05,399 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Akteur#ejbSelectAngebot] Executing SQL: SELECT DISTINCT t0_o.nameAkteurPK, t0_o.nameAktienGesellschaftPK, t0_o.skrontoNrPK FROM Brief t0_o WHERE (t0_o.nameAkteurPK = ? AND t0_o.nameAktienGesellschaftPK = ? AND t0_o.skrontoNrPK = ?)
2004-06-24 18:18:05,399 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Akteur#ejbSelectAngebot] Set parameter: index=1, jdbcType=VARCHAR, value=admin
2004-06-24 18:18:05,399 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Akteur#ejbSelectAngebot] Set parameter: index=2, jdbcType=VARCHAR, value=MAN
2004-06-24 18:18:05,399 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Akteur#ejbSelectAngebot] Set parameter: index=3, jdbcType=INTEGER, value=1
2004-06-24 18:18:05,400 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.Brief] RESET PERSISTENCE CONTEXT: id=[.null.null.0.]
2004-06-24 18:18:05,401 TRACE [org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.Brief] load data: entity=Brief pk=[.null.null.0.]
2004-06-24 18:18:05,401 TRACE [org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.Brief] No preload data found: entity=Brief pk=[.null.null.0.]
2004-06-24 18:18:05,401 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Brief] Default eager-load for entity: readahead=null
2004-06-24 18:18:05,401 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Brief] Executing SQL: SELECT preisMin, angebotsMenge, zeitpunkt FROM Brief WHERE (nameAkteurPK=? AND nameAktienGesellschaftPK=? AND skrontoNrPK=?)
2004-06-24 18:18:05,404 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Brief#nameAkteurPK] Set parameter: index=1, jdbcType=VARCHAR, value=admin
2004-06-24 18:18:05,404 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Brief#nameAktienGesellschaftPK] Set parameter: index=2, jdbcType=VARCHAR, value=Linde
2004-06-24 18:18:05,404 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Brief#skrontoNrPK] Set parameter: index=3, jdbcType=INTEGER, value=1
2004-06-24 18:18:05,410 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.Brief] Store command NOT executed. Entity is not dirty: pk=[.null.null.0.]
2004-06-24 18:18:05,410 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.Akteur] Store command NOT executed. Entity is not dirty: pk=admin
primary-class of bean Brief, methods hashCode() and equals():public int hashCode() { if( _hashCode == 0 ) { if (this.nameAktienGesellschaftPK != null) _hashCode += this.nameAktienGesellschaftPK.hashCode(); _hashCode += (int)this.skrontoNrPK; } return _hashCode; } public boolean equals(Object obj) { if( !(obj instanceof bp.ejb.entityBeans.pk.SkrontoPK) ) return false; bp.ejb.entityBeans.pk.SkrontoPK pk = (bp.ejb.entityBeans.pk.SkrontoPK)obj; boolean eq = true; if( obj == null ) { eq = false; } else { if( this.nameAktienGesellschaftPK == null && ((bp.ejb.entityBeans.pk.SkrontoPK)obj).getNameAktienGesellschaftPK() == null ) { eq = true; } else { if( this.nameAktienGesellschaftPK == null || ((bp.ejb.entityBeans.pk.SkrontoPK)obj).getNameAktienGesellschaftPK() == null ) { eq = false; } else { eq = eq && this.nameAktienGesellschaftPK.equals( pk.nameAktienGesellschaftPK ); } } eq = eq && this.skrontoNrPK == pk.skrontoNrPK; } return eq; }
I'm using MySQL als DB, with mysql-connector-java-3.0.9-stable-bin.jar.
MySQL-Version is 4.0.18.
Regards,
Frank -
5. Re: composed primkey, ejbSelect ... where, condition faills
aloubyansky Jun 25, 2004 5:54 AM (in response to franklemke)It seems like something is wrong with the pk
2004-06-24 18:18:05,349 TRACE [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.Brief] RESET PERSISTENCE CONTEXT: id=[.null.null.0.]
Can you post the pk class implementation and DDs? -
6. Re: composed primkey, ejbSelect ... where, condition faills
franklemke Jun 27, 2004 4:01 PM (in response to franklemke)Hi,
here is a link to the class-diagram:
http://www.frank-dienst.de/Klassen.bmp
The PK-class:/* * Generated by XDoclet - Do not edit! */ package bp.ejb.entityBeans.pk; /** * Primary key for Brief. * @author Frank Lemke */ public class SkrontoEintragPK extends bp.ejb.entityBeans.interfaces.SkrontoEintragPK implements java.io.Serializable { private int _hashCode = 0; private StringBuffer _toStringValue = null; public java.lang.String nameAkteurPK; public java.lang.String nameAktienGesellschaftPK; public int skrontoNrPK; public SkrontoEintragPK() { } public SkrontoEintragPK( java.lang.String nameAkteurPK,java.lang.String nameAktienGesellschaftPK,int skrontoNrPK ) { this.nameAkteurPK = nameAkteurPK; this.nameAktienGesellschaftPK = nameAktienGesellschaftPK; this.skrontoNrPK = skrontoNrPK; } public java.lang.String getNameAkteurPK() { return nameAkteurPK; } public java.lang.String getNameAktienGesellschaftPK() { return nameAktienGesellschaftPK; } public int getSkrontoNrPK() { return skrontoNrPK; } public void setNameAkteurPK(java.lang.String nameAkteurPK) { this.nameAkteurPK = nameAkteurPK; _hashCode = 0; } public void setNameAktienGesellschaftPK(java.lang.String nameAktienGesellschaftPK) { this.nameAktienGesellschaftPK = nameAktienGesellschaftPK; _hashCode = 0; } public void setSkrontoNrPK(int skrontoNrPK) { this.skrontoNrPK = skrontoNrPK; _hashCode = 0; } public int hashCode() { if( _hashCode == 0 ) { if (this.nameAkteurPK != null) _hashCode += this.nameAkteurPK.hashCode(); if (this.nameAktienGesellschaftPK != null) _hashCode += this.nameAktienGesellschaftPK.hashCode(); _hashCode += (int)this.skrontoNrPK; } return _hashCode; } public boolean equals(Object obj) { if( !(obj instanceof bp.ejb.entityBeans.pk.SkrontoEintragPK) ) return false; bp.ejb.entityBeans.pk.SkrontoEintragPK pk = (bp.ejb.entityBeans.pk.SkrontoEintragPK)obj; boolean eq = true; if( obj == null ) { eq = false; } else { if( this.nameAkteurPK == null && ((bp.ejb.entityBeans.pk.SkrontoEintragPK)obj).getNameAkteurPK() == null ) { eq = true; } else { if( this.nameAkteurPK == null || ((bp.ejb.entityBeans.pk.SkrontoEintragPK)obj).getNameAkteurPK() == null ) { eq = false; } else { eq = eq && this.nameAkteurPK.equals( pk.nameAkteurPK ); } } if( this.nameAktienGesellschaftPK == null && ((bp.ejb.entityBeans.pk.SkrontoEintragPK)obj).getNameAktienGesellschaftPK() == null ) { eq = true; } else { if( this.nameAktienGesellschaftPK == null || ((bp.ejb.entityBeans.pk.SkrontoEintragPK)obj).getNameAktienGesellschaftPK() == null ) { eq = false; } else { eq = eq && this.nameAktienGesellschaftPK.equals( pk.nameAktienGesellschaftPK ); } } eq = eq && this.skrontoNrPK == pk.skrontoNrPK; } return eq; } /** @return String representation of this pk in the form of [.field1.field2.field3]. */ public String toString() { if( _toStringValue == null ) { _toStringValue = new StringBuffer("[."); _toStringValue.append(this.nameAkteurPK).append('.'); _toStringValue.append(this.nameAktienGesellschaftPK).append('.'); _toStringValue.append(this.skrontoNrPK).append('.'); _toStringValue.append(']'); } return _toStringValue.toString(); } }
-
7. Re: composed primkey, ejbSelect ... where, condition faills
aloubyansky Jun 28, 2004 4:27 AM (in response to franklemke)Ok, now post the class the pk class extends. And DDs.
The fields from the PK class you posted are not used. Look at field names. -
8. Re: composed primkey, ejbSelect ... where, condition faills
franklemke Jun 28, 2004 12:55 PM (in response to franklemke)Hi,
here is the class, the PK-class extends. They are equal, except of the package name they are
in. So the PK-class, I posted earlier, overrides every field and method of the one, it
extends.
I deleted the phrase "extends bp.ejb.entityBeans.interfaces.SkrontoEintragPK" in the used
PK-Class, packed the EAR-file once more and redeployed it: Now it's working fine. Seems
that JBoss has problems when the pk-class exends another pk-class !?/* * Generated by XDoclet - Do not edit! */ package bp.ejb.entityBeans.interfaces; /** * Primary key for SkrontoEintrag. * @author Frank Lemke */ public class SkrontoEintragPK extends java.lang.Object implements java.io.Serializable { private int _hashCode = 0; private StringBuffer _toStringValue = null; public java.lang.String nameAkteurPK; public java.lang.String nameAktienGesellschaftPK; public int skrontoNrPK; public SkrontoEintragPK() { } public SkrontoEintragPK( java.lang.String nameAkteurPK,java.lang.String nameAktienGesellschaftPK,int skrontoNrPK ) { this.nameAkteurPK = nameAkteurPK; this.nameAktienGesellschaftPK = nameAktienGesellschaftPK; this.skrontoNrPK = skrontoNrPK; } public java.lang.String getNameAkteurPK() { return nameAkteurPK; } public java.lang.String getNameAktienGesellschaftPK() { return nameAktienGesellschaftPK; } public int getSkrontoNrPK() { return skrontoNrPK; } public void setNameAkteurPK(java.lang.String nameAkteurPK) { this.nameAkteurPK = nameAkteurPK; _hashCode = 0; } public void setNameAktienGesellschaftPK(java.lang.String nameAktienGesellschaftPK) { this.nameAktienGesellschaftPK = nameAktienGesellschaftPK; _hashCode = 0; } public void setSkrontoNrPK(int skrontoNrPK) { this.skrontoNrPK = skrontoNrPK; _hashCode = 0; } public int hashCode() { if( _hashCode == 0 ) { if (this.nameAkteurPK != null) _hashCode += this.nameAkteurPK.hashCode(); if (this.nameAktienGesellschaftPK != null) _hashCode += this.nameAktienGesellschaftPK.hashCode(); _hashCode += (int)this.skrontoNrPK; } return _hashCode; } public boolean equals(Object obj) { if( !(obj instanceof bp.ejb.entityBeans.interfaces.SkrontoEintragPK) ) return false; bp.ejb.entityBeans.interfaces.SkrontoEintragPK pk = (bp.ejb.entityBeans.interfaces.SkrontoEintragPK)obj; boolean eq = true; if( obj == null ) { eq = false; } else { if( this.nameAkteurPK == null && ((bp.ejb.entityBeans.interfaces.SkrontoEintragPK)obj).getNameAkteurPK() == null ) { eq = true; } else { if( this.nameAkteurPK == null || ((bp.ejb.entityBeans.interfaces.SkrontoEintragPK)obj).getNameAkteurPK() == null ) { eq = false; } else { eq = eq && this.nameAkteurPK.equals( pk.nameAkteurPK ); } } if( this.nameAktienGesellschaftPK == null && ((bp.ejb.entityBeans.interfaces.SkrontoEintragPK)obj).getNameAktienGesellschaftPK() == null ) { eq = true; } else { if( this.nameAktienGesellschaftPK == null || ((bp.ejb.entityBeans.interfaces.SkrontoEintragPK)obj).getNameAktienGesellschaftPK() == null ) { eq = false; } else { eq = eq && this.nameAktienGesellschaftPK.equals( pk.nameAktienGesellschaftPK ); } } eq = eq && this.skrontoNrPK == pk.skrontoNrPK; } return eq; } /** @return String representation of this pk in the form of [.field1.field2.field3]. */ public String toString() { if( _toStringValue == null ) { _toStringValue = new StringBuffer("[."); _toStringValue.append(this.nameAkteurPK).append('.'); _toStringValue.append(this.nameAktienGesellschaftPK).append('.'); _toStringValue.append(this.skrontoNrPK).append('.'); _toStringValue.append(']'); } return _toStringValue.toString(); } }
With BBs you mean data dictionaries, don't you? I don't have some yet. If you still want it,
tell me. I will create them for you.
Did you see different named fields? I think I missunderstood your "Look at the field names".
You want to find different field-names, don't you?
Okay, thanks a lot for your help so far!
Regards,
Frank -
9. Re: composed primkey, ejbSelect ... where, condition faills
aloubyansky Jun 29, 2004 5:36 AM (in response to franklemke)Sorry, DD stands for Deployment Descriptor.
Look at fields used (as pk?) in your query and field namesin the pk class. They are different. -
10. Re: composed primkey, ejbSelect ... where, condition faills
franklemke Jun 29, 2004 7:24 AM (in response to franklemke)Hi,
sorry, in my first posting I changed the field-names in the query into
english, in order to ease understanding. The realy used query with ger-
man field-names ist this one:/** * @ejb.select query = "select object(o) from Brief o where o.nameAkteurPK=?1 and o.nameAktienGesellschaftPK=?2 and o.skrontoNrPK=?3" */ public abstract Set ejbSelectAngebot(String nameAkteur, String nameAG, int skrontoNr) throws FinderException;
Okay, here comes the DD ;-)<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> <ejb-jar> <description><![CDATA[No Description.]]></description> <display-name>Generated by XDoclet</display-name> <enterprise-beans> ... <entity> <description><![CDATA[]]></description> <ejb-name>Akteur</ejb-name> <home>bp.ejb.entityBeans.interfaces.AkteurHome</home> <remote>bp.ejb.entityBeans.interfaces.Akteur</remote> <local-home>bp.ejb.entityBeans.interfaces.AkteurLocalHome</local-home> <local>bp.ejb.entityBeans.interfaces.AkteurLocal</local> <ejb-class>bp.ejb.entityBeans.classes.AkteurBean</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>java.lang.String</prim-key-class> <reentrant>False</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>Akteur</abstract-schema-name> <cmp-field > <description><![CDATA[]]></description> <field-name>namePK</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>passwort</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>rolle</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>gruppe</field-name> </cmp-field> <primkey-field>namePK</primkey-field> <query> <query-method> <method-name>findAll</method-name> <method-params> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Akteur as o]]></ejb-ql> </query> <query> <description><![CDATA[]]></description> <query-method> <method-name>ejbSelectAktienBestand</method-name> <method-params> <method-param>java.lang.String</method-param> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from AktienBestand as o where o.akteurNamePK=?1 and o.aktienGesellschaftNamePK=?2]]></ejb-ql> </query> <query> <description><![CDATA[]]></description> <query-method> <method-name>ejbSelectGeldTransaktion</method-name> <method-params> <method-param>java.lang.String</method-param> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from GeldTransaktion as o where o.nameAkteurPK=?1 and o.nameAktienGesellschaftPK=?2]]></ejb-ql> </query> <query> <description><![CDATA[]]></description> <query-method> <method-name>ejbSelectNachfrage</method-name> <method-params> <method-param>java.lang.String</method-param> <method-param>java.lang.String</method-param> <method-param>int</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Geld as o where o.nameAkteurPK=?1 and o.nameAktienGesellschaftPK=?2 and o.skrontoNrPK=?3]]></ejb-ql> </query> <query> <description><![CDATA[]]></description> <query-method> <method-name>ejbSelectAngebot</method-name> <method-params> <method-param>java.lang.String</method-param> <method-param>java.lang.String</method-param> <method-param>int</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Brief o where o.nameAkteurPK=?1 and o.nameAktienGesellschaftPK=?2 and o.skrontoNrPK=?3]]></ejb-ql> </query> <!-- Write a file named ejb-finders-AkteurBean.xml if you want to define extra finders. --> </entity> ... <entity > <description><![CDATA[]]></description> <ejb-name>Brief</ejb-name> <home>bp.ejb.entityBeans.interfaces.BriefHome</home> <remote>bp.ejb.entityBeans.interfaces.Brief</remote> <local-home>bp.ejb.entityBeans.interfaces.BriefLocalHome</local-home> <local>bp.ejb.entityBeans.interfaces.BriefLocal</local> <ejb-class>bp.ejb.entityBeans.classes.BriefBean</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>bp.ejb.entityBeans.pk.SkrontoEintragPK</prim-key-class> <reentrant>False</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>Brief</abstract-schema-name> <cmp-field > <description><![CDATA[]]></description> <field-name>preisMin</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>angebotsMenge</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>nameAkteurPK</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>nameAktienGesellschaftPK</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>skrontoNrPK</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>zeitpunkt</field-name> </cmp-field> <query> <query-method> <method-name>findAll</method-name> <method-params> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Brief as o]]></ejb-ql> </query> <query> <query-method> <method-name>findByNameAktienGesellschaftPK</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Brief as o where o.nameAktienGesellschaftPK=?1]]></ejb-ql> </query> <query> <query-method> <method-name>findByNameAkteurPK</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Brief as o where o.nameAkteurPK=?1]]></ejb-ql> </query> <!-- Write a file named ejb-finders-BriefBean.xml if you want to define extra finders. --> </entity> ... </enterprise-beans> ... <relationships > ... <ejb-relation > <ejb-relation-name>Akteur-Brief</ejb-relation-name> <ejb-relationship-role > <ejb-relationship-role-name>AkteurRelationshipRole</ejb-relationship-role-name> <multiplicity>One</multiplicity> <relationship-role-source > <ejb-name>Akteur</ejb-name> </relationship-role-source> <cmr-field > <cmr-field-name>brief</cmr-field-name> <cmr-field-type>java.util.Collection</cmr-field-type> </cmr-field> </ejb-relationship-role> <ejb-relationship-role > <ejb-relationship-role-name>BriefRelationshipRole</ejb-relationship-role-name> <multiplicity>Many</multiplicity> <relationship-role-source > <ejb-name>Brief</ejb-name> </relationship-role-source> </ejb-relationship-role> </ejb-relation> ... </relationships> ... </ejb-jar>
Regards,
Frank -
11. Re: composed primkey, ejbSelect ... where, condition faills
franklemke Jun 29, 2004 7:25 AM (in response to franklemke)Hi,
sorry, in my first posting I changed the field-names in the query into
english, in order to ease understanding. The realy used query with ger-
man field-names ist this one:/** * @ejb.select query = "select object(o) from Brief o where o.nameAkteurPK=?1 and o.nameAktienGesellschaftPK=?2 and o.skrontoNrPK=?3" */ public abstract Set ejbSelectAngebot(String nameAkteur, String nameAG, int skrontoNr) throws FinderException;
Okay, here comes the DD ;-)<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> <ejb-jar> <description><![CDATA[No Description.]]></description> <display-name>Generated by XDoclet</display-name> <enterprise-beans> ... <entity> <description><![CDATA[]]></description> <ejb-name>Akteur</ejb-name> <home>bp.ejb.entityBeans.interfaces.AkteurHome</home> <remote>bp.ejb.entityBeans.interfaces.Akteur</remote> <local-home>bp.ejb.entityBeans.interfaces.AkteurLocalHome</local-home> <local>bp.ejb.entityBeans.interfaces.AkteurLocal</local> <ejb-class>bp.ejb.entityBeans.classes.AkteurBean</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>java.lang.String</prim-key-class> <reentrant>False</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>Akteur</abstract-schema-name> <cmp-field > <description><![CDATA[]]></description> <field-name>namePK</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>passwort</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>rolle</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>gruppe</field-name> </cmp-field> <primkey-field>namePK</primkey-field> <query> <query-method> <method-name>findAll</method-name> <method-params> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Akteur as o]]></ejb-ql> </query> <query> <description><![CDATA[]]></description> <query-method> <method-name>ejbSelectAktienBestand</method-name> <method-params> <method-param>java.lang.String</method-param> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from AktienBestand as o where o.akteurNamePK=?1 and o.aktienGesellschaftNamePK=?2]]></ejb-ql> </query> <query> <description><![CDATA[]]></description> <query-method> <method-name>ejbSelectGeldTransaktion</method-name> <method-params> <method-param>java.lang.String</method-param> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from GeldTransaktion as o where o.nameAkteurPK=?1 and o.nameAktienGesellschaftPK=?2]]></ejb-ql> </query> <query> <description><![CDATA[]]></description> <query-method> <method-name>ejbSelectNachfrage</method-name> <method-params> <method-param>java.lang.String</method-param> <method-param>java.lang.String</method-param> <method-param>int</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Geld as o where o.nameAkteurPK=?1 and o.nameAktienGesellschaftPK=?2 and o.skrontoNrPK=?3]]></ejb-ql> </query> <query> <description><![CDATA[]]></description> <query-method> <method-name>ejbSelectAngebot</method-name> <method-params> <method-param>java.lang.String</method-param> <method-param>java.lang.String</method-param> <method-param>int</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Brief o where o.nameAkteurPK=?1 and o.nameAktienGesellschaftPK=?2 and o.skrontoNrPK=?3]]></ejb-ql> </query> <!-- Write a file named ejb-finders-AkteurBean.xml if you want to define extra finders. --> </entity> ... <entity > <description><![CDATA[]]></description> <ejb-name>Brief</ejb-name> <home>bp.ejb.entityBeans.interfaces.BriefHome</home> <remote>bp.ejb.entityBeans.interfaces.Brief</remote> <local-home>bp.ejb.entityBeans.interfaces.BriefLocalHome</local-home> <local>bp.ejb.entityBeans.interfaces.BriefLocal</local> <ejb-class>bp.ejb.entityBeans.classes.BriefBean</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>bp.ejb.entityBeans.pk.SkrontoEintragPK</prim-key-class> <reentrant>False</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>Brief</abstract-schema-name> <cmp-field > <description><![CDATA[]]></description> <field-name>preisMin</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>angebotsMenge</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>nameAkteurPK</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>nameAktienGesellschaftPK</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>skrontoNrPK</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>zeitpunkt</field-name> </cmp-field> <query> <query-method> <method-name>findAll</method-name> <method-params> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Brief as o]]></ejb-ql> </query> <query> <query-method> <method-name>findByNameAktienGesellschaftPK</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Brief as o where o.nameAktienGesellschaftPK=?1]]></ejb-ql> </query> <query> <query-method> <method-name>findByNameAkteurPK</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql><![CDATA[select object(o) from Brief as o where o.nameAkteurPK=?1]]></ejb-ql> </query> <!-- Write a file named ejb-finders-BriefBean.xml if you want to define extra finders. --> </entity> ... </enterprise-beans> ... <relationships > ... <ejb-relation > <ejb-relation-name>Akteur-Brief</ejb-relation-name> <ejb-relationship-role > <ejb-relationship-role-name>AkteurRelationshipRole</ejb-relationship-role-name> <multiplicity>One</multiplicity> <relationship-role-source > <ejb-name>Akteur</ejb-name> </relationship-role-source> <cmr-field > <cmr-field-name>brief</cmr-field-name> <cmr-field-type>java.util.Collection</cmr-field-type> </cmr-field> </ejb-relationship-role> <ejb-relationship-role > <ejb-relationship-role-name>BriefRelationshipRole</ejb-relationship-role-name> <multiplicity>Many</multiplicity> <relationship-role-source > <ejb-name>Brief</ejb-name> </relationship-role-source> </ejb-relationship-role> </ejb-relation> ... </relationships> ... </ejb-jar>
Regards,
Frank -
12. Re: composed primkey, ejbSelect ... where, condition faills
aloubyansky Jun 30, 2004 7:59 AM (in response to franklemke)The problem is fields were found more than once in the pk class hierarchy and Field objects of the superclass were used.
This is fixed in org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCCMPFieldMetaData.java revision 1.8.2.13.
The warning is logged and the field which is declared in the pk class is used. If a field was not declared in the pk class but still found more than once, the last found will used. -
13. Re: composed primkey, ejbSelect ... where, condition faills
franklemke Jul 1, 2004 6:42 AM (in response to franklemke)Thank you!