• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

how to use finder methods with cmp?

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a finder method and try to call this, but I never get a result or an exception. i dont know if the method is really called, how can i know it? I insert some mistakes in my ejb query language, but i get non exception. Call create() works...?!
Can somebody help please?
my ejb-xml:

my home interface:

call finder:

[ April 03, 2003: Message edited by: Kay Tracid ]
[ April 08, 2003: Message edited by: Kay Tracid ]
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
maybe, somebody knows where to look for my mistake?
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First off, I don't see an <abstract-schema-name> defined in your descriptor.
Secondly, CMP is still very dependent on the application server that you are using (much less than in EJB 1.1 though). Therefore, I suggest you give details of your Application Server and other configuration, and post this question in the appropriate forum. JavaRanch has forums for most major Application Servers.
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh, sorry, i use JBoss 3.0.4 with oracle 9. i added the abstract-schema-name, but i have the same problem as before. i need to know where to look for my mistake. is somewhere in jboss logged which finder methods are there? how do i know that the query in ejb-jar is not ignored? i'm sorry if this is the wrong forum, please move it to jboss forum.
Thanks
[ April 08, 2003: Message edited by: Kay Tracid ]
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you don't see any errors while deploying in jboss try to put some log("") lines and check whether it prints it or not. you can also check your datasource mapping. I think is the mysql-service.xml file located in the deploy directory.
there's another file called standardjbosscmp-jdbc.xml, check it... but they're should be ok if you're not gettn any errors while deploying..
good luck
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot, where i should add the log lines? It seems that the <quest> in ejb-jar.xml is ignored.
I think my OracleDS is working because i can call the home.create() method. I installed jboss 3.0.6 again, and it starts fine. no warnings, no errors.
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kay Tracid:
Thanks a lot, where i should add the log lines? It seems that the <quest> in ejb-jar.xml is ignored.
I think my OracleDS is working because i can call the home.create() method. I installed jboss 3.0.6 again, and it starts fine. no warnings, no errors.


hmm.. what do you mean it starts fine? did JBoss start fine? or did you copy your file to the deploy directory jbossInstalation/server/default/deploy
and JBoss deployed it without any problems?
what <quest> did you mean?
the log (or System.out.println) should go in your bean class, something like:
log("got home interface")
and if your enumeration has actually any elements, print something meaningful..
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i mean both is fine. jboss starts fine and deploy the beans.jar is fine, too. yes i deploy my jar to server/default/deploy without problems.
sorry i mean the <query> tag in my ejb-jar seems to be ignored. i dont know if i should get an exception in case of a syntax error in my ejb ql. tell me please, is jboss pharsing it while deploying? or should i get an exception when i call the finder method? my bean works fine so i dont see a reason to print something out. my only problem is the finder method...
thanks a lot for your help
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, if you have a syntax error in your ejb ql you should get an error when you deploy your file into the deploy directory. That's happenned to me many times, specially with EJB QL queries..
I'm just guessing... but if you added the <abstract-schema-name>, maybe you can show us again a snippet of your new ejb-jar.xml and the bean implementation (also a snippet ;-) ). If it is really different at the one you post before..
don't know... hhmmm... let us know..
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ejb-jar.xml

E_EmotionHome.java

E_EmotionRemote.java

E_EmotionBean.java

E_EmotionPrimaryKey.java
package ejb.bean;
public class E_EmotionPrimaryKey implements java.io.Serializable {
public Integer e_id;
public E_EmotionPrimaryKey(Integer e_id) {
this.e_id = e_id;
}
public E_EmotionPrimaryKey() {
}
public String toString() {
return e_id.toString();
}
}
call finder:

thats all i have. i found a single entity with findByPrimarykey(), but the collection for findbyAllE_Emotions is empty.
[ April 09, 2003: Message edited by: Kay Tracid ]
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Abstract schema name should be beneath the entity element, not at the same level. And also, the thing you should be SELECTing from is the Abstract Schema name, not the bean name. Really, I would STRONGLY suggest you take a look at either Richard Monson-Haefel's book or Ed Roman's book -- they have MANY examples of fully working EJB DD's that you can work from. This is pretty basic stuff covered very well in both books. It would be much more productive if you read and worked from one of those rather than floundering around like this.
Kyle
[ April 09, 2003: Message edited by: Kyle Brown ]
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for help. maybe i'm very stupid, but i didn't found much infomation in Ed Roman's book about ejb-ql and deployment descriptor and jboss. i found something about ejb-ql in the www, maybe it will help.
thx
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kay Tracid:
Thanks for help. maybe i'm very stupid, but i didn't found much infomation in Ed Roman's book about ejb-ql and deployment descriptor and jboss. i found something about ejb-ql in the www, maybe it will help.
thx



You're not stupid -- just not working from enough information. Buy Richard Monson-Haefel's book. It's EXCELLENT in this regard.
Kyle
 
It's never done THAT before. Explain it to me tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic