-
1. Re: AutoGenerating PK & Oracle
adrian.brock Oct 30, 2003 9:59 AM (in response to mozheyko_d)Use the CMP forum.
And also use search.
Regards,
Adrian -
2. Re: AutoGenerating PK & Oracle
mozheyko_d Oct 31, 2003 12:17 AM (in response to mozheyko_d)Search finds separately "unknown-pk" and "Oracle". There can be I am not able to use him? If you such clever learn me.
-
3. Re: AutoGenerating PK & Oracle
darranl Oct 31, 2003 5:24 AM (in response to mozheyko_d)mozheyko_d if your clever enough to use JBoss learn to use the forum and search for yourself, this topic has been discussed loads.
-
4. Re: AutoGenerating PK & Oracle
adrian.brock Oct 31, 2003 6:19 AM (in response to mozheyko_d)Look at the entity creation commands in
conf/standardjbosscmp-jdbc.xml
You will notice the default configuration at the top and the
options at the bottom.
Then look at this change note.
http://sourceforge.net/tracker/index.php?func=detail&aid=733429&group_id=22866&atid=381174
Then buy the admin docs, I'm sure you've wasted more than
10 bucks of your time trying to figure this out.
Then go to the CMP forum!
Regards,
Adrian -
5. 2 darranl
mozheyko_d Nov 4, 2003 9:45 AM (in response to mozheyko_d)Thanks you for your kindness and responsiveness
-
-
-
8. Re: AutoGenerating PK & Oracle
mozheyko_d Nov 4, 2003 10:37 AM (in response to mozheyko_d)Thanks, adrian. Earlier I used FirebirdSQL and had considerable problems with AutoIncrement. I see, that at Oracle with it all is much better.
-
9. Re: AutoGenerating PK & Oracle
kryptontri Nov 4, 2003 10:55 AM (in response to mozheyko_d)Thank you for many kindness
-
10. Re: AutoGenerating PK & Oracle
jdacev Jun 3, 2004 4:49 PM (in response to mozheyko_d)AutoGenerating PK & Oracle
--1, the EJB Test:
import javax.ejb.EntityBean;
/**
* @ejb.bean name="Test"
* jndi-name="TestBean"
* type="CMP"
* primkey-field="id"
* schema="testSchema"
* cmp-version="2.x"
*
* @ejb.persistence
* table-name="SVD_TEST"
*
* @ejb.finder
* query="SELECT OBJECT(a) FROM testSchema as a"
* signature="java.util.Collection findAll()"
*
* @jboss.entity-command name="oracle-sequence" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCOracleCreateCommand"
* @jboss.entity-command-attribute name="sequence" value="SEQ_SVD_TEST"
*
**/
public abstract class TestBean implements EntityBean {
/**
* The ejbCreate method.
*
* @ejb.create-method
*/
public java.lang.Integer ejbCreate(Integer id, String nombre) throws javax.ejb.CreateException {
setId(id);
setNombre(nombre);
return null;
}
/**
* The container invokes this method immediately after it calls ejbCreate.
*
*/
public void ejbPostCreate(Integer id, String nombre) throws javax.ejb.CreateException {}
/**
* Returns the id
* @return the id
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="ID"
* sql-type="NUMBER"
* @ejb.pk-field
* @ejb.interface-method
*/
public abstract java.lang.Integer getId();
/**
* Sets the id
*
* @param java.lang.Integer the new id value
*
* @ejb.interface-method
*/
public abstract void setId(java.lang.Integer id);
/**
* Returns the nombre
* @return the nombre
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="NOMBRE"
* sql-type="VARCHAR2"
*
* @ejb.interface-method
*/
public abstract java.lang.String getNombre();
/**
* Sets the nombre
*
* @param java.lang.String the new nombre value
*
* @ejb.interface-method
*/
public abstract void setNombre(java.lang.String nombre);
}
--2, the jbosscmp-jdbc.xml
<ejb-name>Test</ejb-name>
<table-name>SVD_TEST</table-name>
<cmp-field>
<field-name>nombre</field-name>
<column-name>NOMBRE</column-name>
</cmp-field>
<unknown-pk>
<unknown-pk-class>java.lang.Integer</unknown-pk-class>
<field-name>id</field-name>
<column-name>ID</column-name>
<jdbc-type>INTEGER</jdbc-type>
<sql-type>NUMBER</sql-type>
<auto-increment/>
</unknown-pk>
<entity-command name="oracle-sequence" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCOracleCreateCommand">
SEQ_SVD_TEST
</entity-command>
--3, in the section: <entity-commands>, file: \jboss-3.2.3\server\all\conf\standardjbosscmp-jdbc.xml
<entity-commands>
<entity-command name="oracle-sequence" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCOracleCreateCommand">
SEQ_SVD_TEST
</entity-command>
</entity-commands>
--4, in Oracle, create the sequence: SEQ_SVD_TEST
CREATE SEQUENCE SEQ_SVD_TEST
START WITH 1
INCREMENT BY 1
MINVALUE 1
MAXVALUE 1E17
NOCACHE
CYCLE ORDER;
--5, Ready.
Creo que esto es todo.
Yo tengo implementado esto utilizando Oracle9i, JBOSS 3.2.3 y The Ecplipse project como IDE y funciona perfecto.
See you. -
11. Re: AutoGenerating PK & Oracle
aloubyansky Jun 4, 2004 3:01 AM (in response to mozheyko_d)This configuration is wrong because it declares an existing (known) CMP field as unknown.
-
12. Re: AutoGenerating PK & Oracle
erik777 Jun 5, 2004 4:10 PM (in response to mozheyko_d)This is a bit offtopic, jdacev, but how does XDoclet handle cases where your beans are subclassed from classes in a reusable library? Particularly, what about when the methods aren't even overriden? This means your project's classes don't actually have the methods, and thus don't have the comments for XDoclet tags.
I'm just curious, because this is the case with all my CMP beans as well as some session beans. -
13. Re: AutoGenerating PK & Oracle
davidsills Jun 22, 2004 6:16 PM (in response to mozheyko_d)Yes, it's off topic, but I see no one saw fit to answer. XDoclet does search the hierarchy for XDoclet tags, which is useful if you still have source. Since we often don't, the best solution we have found for this is to repeat the method in the subclass, simply delegating to the superclass method. This gives us a hook upon which to put XDoclet tags. Yes, a hack, to some extent, but would you rather write the interfaces?