hi,

bevore we switched to MySQL with InnoDB tables we used PostgreSQL:

<entity>
<ejb-name>UsersBean</ejb-name>
<read-ahead>
...
</read-ahead>
<table-name>users</table-name>
<cmp-field>
<field-name>users_id</field-name>
<auto-increment/>
</cmp-field>
... other fields ...
<entity-command name="pk-sql">
<attribute name="pk-sql">SELECT nextval('users_seq')</attribute>
</entity-command>
</entity>


We get the id for PK from a sequence.


Regards, Rafal

At 17:42 06.09.2003 -0700, you wrote:
When I put

@jboss.persistence
   auto-increment="true"

into PartnerBean.java it generates the following in jbosscmp-jdbc.xml:

      <entity>
         <ejb-name>Partner</ejb-name>
         <table-name>v_partners</table-name>

         <cmp-field>
            <field-name>partnerId</field-name>
            <column-name>partner_id</column-name>

                        <auto-increment/>
        </cmp-field>
         <cmp-field>
            <field-name>name</field-name>
            <column-name>name</column-name>

        </cmp-field>
         <cmp-field>
            <field-name>description</field-name>
            <column-name>description</column-name>

</cmp-field>

Upon startup JBoss states that this is an invalid XML file:

17:35:49,136 INFO [EntityContainer] Starting
17:35:50,627 ERROR [XmlFileLoader] XmlFileLoader: File
file:/usr/local/jboss-3.2.2RC3/server/default/deploy/versaly.ear/ versaly.jar/META-INF/jbosscmp-jdbc.xml process error. Line: 144. Error
message: Element type "auto-increment" must be declared.
17:35:50,633 ERROR [XmlFileLoader] XmlFileLoader: File
file:/usr/local/jboss-3.2.2RC3/server/default/deploy/versaly.ear/ versaly.jar/META-INF/jbosscmp-jdbc.xml process error. Line: 145. Error
message: The content of element type "cmp-field" must match
"(field-name,read-only?,read-time-out?,column-name?,not-null?,((jdbc- type,sql-type)|property+)?)".
17:35:50,710 ERROR [EntityContainer] Starting failed
org.jboss.deployment.DeploymentException: Invalid XML:
file=file:/usr/local/jboss-3.2.2RC3/server/default/deploy/versaly.ear/ versaly.jar/META-INF/jbosscmp-jdbc.xml


Is there either a way to change the DTD for this XML doc or to turn of
XML validation against the DTD?
  When I remove <auto-increment/> from jbosscmp-jdbc.xml things work
just fine.
  -M@


On Saturday, September 6, 2003, at 01:37 PM, Alexey Loubyansky wrote:


Yes, pk fields should be excluded from INSERT.
Post relevant DD snippets if you still have problems.

alex

Matthew Hixson wrote:

Thanks for the reply, Alex.  Do these instructions hold true for
3.2.2RC3 as well?  I just tried this with that version, but it is
still trying to put the primary key into the insert statement.
  What behavior should I see when the below settings have taken
affect?  Will JBoss stop trying to execute this statement:
INSERT INTO v_partners (partner_id, name, description,
partner_type_id) VALUES (null, 'dfadf', 'adfasdf', null);
and instead do something like this:
INSERT INTO v_partners (name, description, partner_type_id) VALUES
('dfadf', 'adfasdf', null);
Thanks,
   -M@
On Saturday, September 6, 2003, at 02:13  AM, Alexey Loubyansky wrote:
/**
 *
 * @jboss:entity-command name="postgresql-fetch-seq"
 */
public abstract class ChildCMPBean
   implements EntityBean
{
   /**
    * @ejb.pk-field
    * @jboss.persistence auto-increment="true"
    */
   public abstract Integer getId();

Check that 3.2.1 has postgresql-fetch-seq command in
standardjbosscmp-jdbc.xml

HTH

alex

Matthew Hixson wrote:

Is anyone on the list currently using JBoss 3.2.1 with CMP and
Postgres 7.3.x?  I am having a problem where JBoss wants to execute
SQL inserts with 'null' as the primary key of the record where I
would rather Postgres create the primary key for me.
  I've seen posts such as this one:
http://archives.postgresql.org/pgsql-performance/2003-02/ msg00062.php
So it sounds to me like people have been doing this since the JBoss
3.0.x days.
  Any help on getting JBoss to not put the primary key into the SQL
statement would be greatly appreciated.
  Thanks,
   -M@
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user



------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user



------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to