File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes EJB Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Problem" Watch "EJB Problem" New topic
Author

EJB Problem

Safin Ahmed
Greenhorn

Joined: Feb 08, 2006
Posts: 19
Hi,

I'm with a strange problem, that i can't find a solution for, even though it sound like a pretty standard thing

I have a CMP that has a CMR (1:N) with another CMP
Let's say that a Customer has a CMR with CustomerHistory (that is, a Customer has many CustomerHistory items)
Customer has a simple PK (a Long Type ID)
CustomerHistory has a composed PK (a Long Type CustomerID and a Long Type Version)

Well in here lies the problem, because in CustomerHistory, CustomerID is part of the Primary Key, and also is the Foreign Key to Customer

Because of that (or at least i think it's because of that)
When i'm in a CustomerBean and i try to get All the CustomerHistoryBean that are associated with this Customer i get a Collection of NULLs
What is more strange is that i get a correct number of NULL objects, that is, if in a Customer i have 5 CustomerHistorys related, i get a Collection with 5 NULLs

Anyone knows how can i solve this ?

In my Database i have other tables with other relations, and all of them work fine because all of them have simple PKs, except for this one, which is the one that doesn't work

Any help would be appreciated

Thanks in advanced
Safin Ahmed
Greenhorn

Joined: Feb 08, 2006
Posts: 19
OK
So i found out the real problem
And the problem is that my CustomerHistory has a Text Field, as in a MS SQL Server TEXT Field
When i changed it to a VARCHAR, it started working
The strangest thing is that Customer also has a TEXT Field (mapped to a String) and i can do Finds without any problems

So my question now is how can i work with TEXT in CMPs ?

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB Problem
 
Similar Threads
CMR entity beans and primary key.
EJB design suggestions
CMR Problem
CMP findBy
Choose primary key for CMR entity beans