Hello,
How do you get a reference to your primary key using your method below?
sesques wrote : Normally, this should work and is compliant wth the EJB spec.
| (But if not, keep your version as well, it will be a software mystery ;-)
|
|
| | /**
| | * The Employee Entity Bean
getPrimaryKey() on EJB[Local]Object or EntityContext.
View the original post :
http://www.jboss.org/index.html?module=bbop=viewtopicp=3839177#3839177
Reply to the post :
http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3839177
With MySQL you can have AutoIncrement Primary Key Fields without using Unknown-PK's
BUT you have to let JBoss create the Database (or make sure you create it correctly to
match what JBoss is looking for.
The key is to dec;are your PK in jbosscmp-jdbc.xml as
auto-increment/
and have the
Sesques --
I've tried quite a number of different variations on the xdoclet tags, and each
variation has its problems. Here are some samples of what seem to be perverse
interactions between CMR and unknownpk:
00:40:52,984 INFO [EjbModule] Deploying FaqCategoryEJB
| 00:40:52,984 INFO
Hi hpx,
I confess having no interrest on Nukes, so I cannot help you about it.
About unknow-pk and CMR, of course unknown-pk can be used by relationships.
I use it myself without problem, declaring unknow-pk field-name as related-pk-field on
a jboss relation:
Example:
My first entity bean
Hi --
Has anybody noticed Unknown-PK Problems, with XDoclet and _CMR_?
Are there known-bugs regarding CMR interaction with Unknown-PK that have already been
posted against JBoss3.2.3?
Anybody know of relevant forum/wiki URLs?
Or... has anybody gotten Unknown-PK going with XDoclet and _CMR_,
Unknow-pk got nothing to do with CMR fields
View the original post :
http://www.jboss.org/index.html?module=bbop=viewtopicp=3831936#3831936
Reply to the post :
http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3831936
---
Yes, CMR and unknown-pk are distinct concepts, but they could interact in
practice because CMR creates foreign key relationships and thus uses the pk of the
entity at the other end of the relationship.
View the original post :
That are good points.
In fact, now that you tell it, I remember to have read the object things and am now
wondering, why this works. Well, it does. Even though the ejbCreate is Integer.
Strange...
I had an error, with not declaring a pk-field, or having a pk-field declared, which is
no
Normally, this should work and is compliant wth the EJB spec.
(But if not, keep your version as well, it will be a software mystery ;-)
| /**
| * The Employee Entity Bean handles the information of an employee.
| * @author Karsten Jahn (OrangeOak)
| * @version 1.0
| *
| *
Well... what can I say... this works perfectly as well... thank you very much!
Being within the EJB spec is a bit more sedative. ;)
View the original post :
http://www.jboss.org/index.html?module=bbop=viewtopicp=3830279#3830279
Reply to the post :
Yes, it works perfect by now. Well, in fact, I do have some ForeignKey Problems, but
that's a different story... ;)
This is the solution:
ejb-jar.xml
| entity
| description![CDATA[The Employee Entity Bean saves every
Employee.]]/description
|
Normally, when the key is auto-generated byt the database,
the prim-key-class should be java.lang.Object without declaring the primkey-field
(like in your first version of ejb-jar.xml)
+ No getters and setters defined on the CMP field employeeID (because you must use the
findbyPrimaryKey method
For MySQL,
you mus set
entity-command name=mysql-get-generated-keys /
View the original post :
http://www.jboss.org/index.html?module=bbop=viewtopicp=3830104#3830104
Reply to the post :
http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3830104
I do have it - in the defaults section
entity-command name=mysql-get-generated-keys
class=org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand/
View the original post :
http://www.jboss.org/index.html?module=bbop=viewtopicp=3830116#3830116
Reply to the post :
And btw The Primary key is working correctly without using the Unknown-PK We are using
the
mysql-connector-java-3.1.1-alpha-bin.jar
and configuring the settings as follows
ejb-nameTransTypeBean/ejb-name
Hi,
So, is your problem solved ?
I really don't understand how you can make a database generated key without an unknown
primary key. I don't know mySQL, just Oracle and MSSQL, and I have many projecs
working with database generated keys using the unknown-pk.
Are you sure it is the database
Hi,
You are missing a entity-command name tag in your jbosscmp-jdbc.xml.
This tag is database dependent (used to get the last generated primary key. For MSSQL,
you must set
entity-command name=mssql-fetch-key /
View the original post :
18 matches
Mail list logo