Hello Cheng,
If they know which columns correspond to the Unique Index they can map these as the PK's in EJB3 even though they are not specified as PK's in their tables. These @Id mappings would satisfy the EJB3.0 requirements but their application would not be required to use these PK's if they did not apply. All queries could be JPA queries.
--Gordon
-----Original Message-----
From: Cheng.Fang_at_Sun.COM [mailto:Cheng.Fang_at_Sun.COM]On Behalf Of Cheng
Fang
Sent: Monday, July 31, 2006 3:30 PM
To: dev_at_glassfish.dev.java.net
Subject: primary tables with no primary key supported in EJB 3?
Follow-up question for the user: is this supported in Glassfish EJB 3
(Persistence)?
http://gceclub.sun.com.cn/NASApp/sme/jive/thread.jsp?forum=22&thread=39131
The reason he/she is asking this question is, his company used C and
Informix 7 before, and it has been working pretty well for 7 years.
They don't know why these tables have no primary key (most only have
unique index), since original developers have left.
Now they are working on a new project, and evaluating EJB 3
(persistence) for possible use. They need to use these legacy data, but
don't want change the database structure. They have hundreds of tables
like this and some talbes contain several million records.
In Glassfish EJB 3, is it possible to loosen the validation and allow
these apps to deploy and run, maybe with some sort of warning? The user
said situations like this is not uncommon. And any advice in general?
Their app deploys and runs fine on Jboss.
Thanks,
Cheng
Marina Vatkina wrote:
> No, we do not support primary tables without primary keys for CMP 2.1.
>
> regards,
> -marina
>
> Cheng Fang wrote:
>
>> This user is using ejb 2.1 on SJSAS PE 9. The Student table doesn't
>> designate a primary key, but in ejb code he uses 'id' as if it was a
>> primary key. The app failed to deploy on SJSAS 9. But he was able to
>> deploy and run the same app on JBoss.
>>
>> error messages (hope you can tell something from a few keywords)
>> Deploying application in domain failed; 运行 EJBC 时发生错误 -- 来自
>> EJB 编译器的致命错误 -- JDO74025: JDOCodeGenerator: 验证应用程序
>> “EJBModule1” 的模块“EJBModule1”中的 CMP Bean“Fhdsckfhz”时捕获异常:
>> JDO72335: 如果与生 成的类 testsss.FhdsckfhzBean96247497_JDOState 对应
>> 的 Bean 的表 fhdsckfhz 被映射为主表, 则它必须有主键。请选择其它主表或
>> 验证模式文件的内容是否正确。
>>
>> Once he specified 'id' as primary key in database table, it deploys
>> and runs fine. So the question is, does SJSAS 9 ejb 2.x support
>> tables with no primary key?
>>
>> More details are here:
>> http://gceclub.sun.com.cn/NASApp/sme/jive/thread.jsp?forum=22&thread=39131
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: dev-help_at_glassfish.dev.java.net