Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unexpected problem  RSS feed

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
I have a J2EE application, consists of some entity beans, session beans and JSPs.
I have deployed this application into JBoss and I don't have any problems.
I added some entries to the database using entity beans.
then, I tried to deploy this application to J2EE RI 1.4 (SJSAS 8.0).
now the application is running on RI 1.4 , I search for some values that I have entered previously in JBoss and I got the expected results without any problems.
then I treid to add some recoreds to the database while the application on RI 1.4 using my entity beans, no problems here.
I shut down the RI 1.4 and run JBoss.
I want to search for the entity bean that has been added in RI 1.4 but I got the following exception :

well, I am confused here, J2EE applications should be portable between J2EE servers but not in my case !
RI 1.4 is able to search for entity beans that had been added in JBoss but not vise versa..
some one shed some lights here ??
thanks.
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Todd:
Entity not found: primaryKey=;
That message makes it seem you searched for a bean with an empty String primary key. What is the primary key class? Using the same code, can you still find the beans originally created in the first JBoss run? Finally (or first!) check the database and verify that all the values look as you'd expect.

It seems very unlikely that beans created under runs in different containers would be "incompatible" since they are merely saved in the database. If the data is good, it doesn't matter how it got there.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, here are some tips.
This is a snapt shot of my table :

(Player_Team filed allows null)
Player_Team field gets its value if we set Player entity's team CMR filed, something like this :

it is legal in my application to create a player without specifing his team.
running this in JBoss, the table become:

running this in RI 1.4 :

(note the blank filed in the table)
any ideas ??
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was looking at the exception again: Entity not found: primaryKey=;
I don't know why JBoss is generating this exception, I supplied the primary key, but why JBoss is looking for the FK ??
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Todd:
I was looking at the exception again: Entity not found: primaryKey=;
I don't know why JBoss is generating this exception, I supplied the primary key, but why JBoss is looking for the FK ??
Now it makes sense. The RI is creating your Player row not with a null Team FK but with a Team FK of "" which JBoss then thinks points to a valid Team and does a search ni the Team table using that non-existent PK, thus the exception.

So the problem is the RI's use of "" instead of null. What database is this running on? Have you tried specifically setting the team to null instead of uninitialized? Finally, can you verify that the team field is indeed an empty string (versus a bunch of spaces)?

It looks like the RI has a bug, though.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!