Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB Problem

 
Safin Ahmed
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic