[JBoss-user] [Persistence & CMP/JBoss] - Re: Postgresql 7.4.x/8.0, CMP and auto-increment
> // Important: NO Setter/Getter/Xdoclet stuff for the primary-field ! If i leave these, how could i ever build CMR's ? I've been looking for a solution and on the following posting a sugestion is posted however during compilation it brakes. http://www.jboss.org/index.html?module=bb&op=viewtopic&t=54267 It breaks as Jboss generates a line: anonymous wrote : pk = new java.lang.Object(this.getId()); Which can't be compiled under java 5.0 or is simply wring .. Could anybody please provide me how to get CMR working here? Wessel de Roode View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3872445#3872445 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3872445 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Postgresql 7.4.x/8.0, CMP and auto-increment
Hi, thanks again. Now the Bean works. Here is the summary (XDoclet): Bean-Xdoclet-Descriptor | | /** | * @ejb.bean name="Kunde" display-name="Name for KundeBean" | * description="Description for KundeBean" jndi-name="ejb/Kunde" | * type="CMP" cmp-version="2.x" view-type="local" | * | * @ejb.pk class = "java.lang.Object" generate = "false" ejb.value-object match = | * "*" name = "KUNDE" | * | * @ejb.value-object match = "*" name = "Kunde" | * | * @jboss.persistence table-name = "KUNDE" read-only = "false" create-table = | *"false" remove-table = "false" | * | * @jboss.entity-command name="postgresql-fetch-seq" | * class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCPostgreSQLCreateCommand" | * | * @jboss.unknown-pk auto-increment = "true" column-name = "KUNDE_ID" jdbc-type = | * "BIGINT" sql-type = "INT8" class = "java.lang.Object" | * | */ Entity Bean Methods | | /** | * @ejb.create-method view-type = "local" | * | * @throws CreateException | */ | public java.lang.Object ejbCreate(String firmenname, String strasse, | String plz, String ort, String telefon, String fax, | String webSeiteURL, String email) throws CreateException { | // | return null; | } | | // Important: NO Setter/Getter/Xdoclet stuff for the primary-field ! | Using Session Bean creating the entity bean | /** | * @ejb.interface-method view-type = "both" | */ | public java.lang.Object createKunde(String firmenname, String strasse, | String plz, String ort, String telefon, String fax, | String webSeiteURL, String email) throws ECannotCreateException { | | KundeLocal myKundeLocal = null; | | try { | Logger.log("KundeMgrBean.createKunde()"); | myKundeLocal = this.myKundeLocalHome.create(firmenname, strasse, | plz, ort, telefon, fax, webSeiteURL, email); | | Logger.log("Neue Kundenid: " + myKundeLocal.getPrimaryKey()); | return myKundeLocal.getPrimaryKey(); | | } catch (CreateException e) { | throw new ECannotCreateException("Cannot create 'Kunde' " | + firmenname, e); | } | } | View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3869668#3869668 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3869668 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Postgresql 7.4.x/8.0, CMP and auto-increment
take a look at my other posting on the Informix/auto-increment http://www.jboss.com/index.html?module=bb&op=viewtopic&t=61244 You don't have to return anything in ejbCreate(), just return null lets say you are creating your entity bean from a session bean using blaHome.create() which returns blaLocal. you can always get the primary key on that object. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3869589#3869589 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3869589 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Postgresql 7.4.x/8.0, CMP and auto-increment
Whow, great, your solutions work great !! Thx Could you tell me also b) How to get the PK in the createMethode to return it to the client ? regards Danny View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3869442#3869442 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3869442 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: Postgresql 7.4.x/8.0, CMP and auto-increment
Hi Based on my search in the forum I gathered the following - On the entity level you need to specify the following tag @jboss.entity-command * name="informix-serial" * class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCInformixCreateCommand" in your case name = postgresql-fetch-seq and the class would be org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCPostgreSQLCreateCommand an on you getId() method you need to specify the following tag @jboss.persistance auto-increment ="true" you can see the result of these two steps in your jbosscmp-jdbc.xml on the entity you will get and on the field you will get the I did all of that for my entity and I mange to deploy it successfully BUT whenevr I try to create an new enity.. I get the following exception 22:17:50,126 ERROR [MyEntity] Could not create entity java.sql.SQLException: Primary key on table (mytable) has a field with a null key value. at com.informix.jdbc.IfxSqli.addException(IfxSqli.java:3082) at com.informix.jdbc.IfxSqli.receiveError(IfxSqli.java:3396) at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2259) at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2179) at com.informix.jdbc.IfxSqli.executeCommand(IfxSqli.java:721) at com.informix.jdbc.IfxResultSet.executeUpdate(IfxResultSet.java:305) at com.informix.jdbc.IfxStatement.executeUpdateImpl(IfxStatement.java:882) >From the postings I feel that these two steps are enough (give it a try it >might work for you) View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3869316#3869316 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3869316 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user