Creating a record in database

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating a record in database

hairi007
(ofBiz newbie)
Hi guys, im using a service to create a record in a database
All tehe required datas are keyed in a textfield
service.xml
 <service name="createCustRequest" engine="simple" default-entity-name="CustRequest" location="org/ofbiz/order/request/CustRequestServices.xml" invoke="createCustRequest" auth="true">
        <description>Create a custRequest record and optionally create a custRequest item.</description>
        <attribute name="custRequestId" type="String" mode="IN" optional="true"/>
         <attribute name="fromPartyId" type="String" mode="IN" optional="true"/>
          <attribute name="custRequestDate" type="String" mode="IN" optional="true"/>
        <attribute name="statusId" type="String" mode="IN" optional="true"/>
    </service>


and the simple method

   <simple-method method-name="createCustRequest" short-description="Create Customer Request">
        <make-value value-field="newEntity" entity-name="CustRequest"/>
        <set-nonpk-fields map="parameters" value-field="newEntity"/> 
     
        <set from-field="fromPartyId" field="newEntity.fromPartyId"/>
        <set from-field="custRequestDate" field="newEntity.custRequestDate"/>
        <set from-field="statusId" field="newEntity.statusId"/>
       
                <sequenced-id sequence-name="CustRequest" field="custRequestId"/>
        <to-string field-name="custRequestId"/>
        <set from-field="custRequestId" field="newEntity.custRequestId"/>
        <create-value value-field="newEntity"/>
        <field-to-result field="custRequestId" map-name="newEntity"/>

    </simple-method>
       

When i click submit it shows success,however the new record is not reflected on my DB when i check ed it from webtools..Need your help ..thnx! :)
Reply | Threaded
Open this post in threaded view
|

Re: Creating a record in database

BJ Freeman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

what does the logs say
what version of ofbiz are you using


hairi007 sent the following on 2/22/2009 10:23 AM:

> (ofBiz newbie)
> Hi guys, im using a service to create a record in a database
> All tehe required datas are keyed in a textfield
> service.xml
>  <service name="createCustRequest" engine="simple"
> default-entity-name="CustRequest"
> location="org/ofbiz/order/request/CustRequestServices.xml"
> invoke="createCustRequest" auth="true">
>         <description>Create a custRequest record and optionally create a
> custRequest item.</description>
>         <attribute name="custRequestId" type="String" mode="IN"
> optional="true"/>
>          <attribute name="fromPartyId" type="String" mode="IN"
> optional="true"/>
>           <attribute name="custRequestDate" type="String" mode="IN"
> optional="true"/>
> <attribute name="statusId" type="String" mode="IN" optional="true"/>
>     </service>
>
>
> and the simple method
>
>    <simple-method method-name="createCustRequest" short-description="Create
> Customer Request">
>         <make-value value-field="newEntity" entity-name="CustRequest"/>
>         <set-nonpk-fields map="parameters" value-field="newEntity"/>
>      
>         <set from-field="fromPartyId" field="newEntity.fromPartyId"/>
>         <set from-field="custRequestDate"
> field="newEntity.custRequestDate"/>
>         <set from-field="statusId" field="newEntity.statusId"/>
>        
> <sequenced-id sequence-name="CustRequest" field="custRequestId"/>
>         <to-string field-name="custRequestId"/>
>         <set from-field="custRequestId" field="newEntity.custRequestId"/>
>         <create-value value-field="newEntity"/>
>         <field-to-result field="custRequestId" map-name="newEntity"/>
>
>     </simple-method>
>
>
> When i click submit it shows success,however the new record is not reflected
> on my DB when i check ed it from webtools..Need your help ..thnx! :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJobGwrP3NbaWWqE4RAueVAJ9AG4MQ2atVXg4GfwKe8lMYnU446ACgm28u
fnN8eVg5AIJ1SMJnv2pp5bM=
=BiVE
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: Creating a record in database

Ravindra Mandre
In reply to this post by hairi007
hello,
Put all log messages that you are getting on terminal so that anyone can
help you :-)

Regards
Ravindra Mandre


hairi007 wrote:

> (ofBiz newbie)
> Hi guys, im using a service to create a record in a database
> All tehe required datas are keyed in a textfield
> service.xml
>  <service name="createCustRequest" engine="simple"
> default-entity-name="CustRequest"
> location="org/ofbiz/order/request/CustRequestServices.xml"
> invoke="createCustRequest" auth="true">
>         <description>Create a custRequest record and optionally create a
> custRequest item.</description>
>         <attribute name="custRequestId" type="String" mode="IN"
> optional="true"/>
>          <attribute name="fromPartyId" type="String" mode="IN"
> optional="true"/>
>           <attribute name="custRequestDate" type="String" mode="IN"
> optional="true"/>
> <attribute name="statusId" type="String" mode="IN" optional="true"/>
>     </service>
>
>
> and the simple method
>
>    <simple-method method-name="createCustRequest" short-description="Create
> Customer Request">
>         <make-value value-field="newEntity" entity-name="CustRequest"/>
>         <set-nonpk-fields map="parameters" value-field="newEntity"/>
>      
>         <set from-field="fromPartyId" field="newEntity.fromPartyId"/>
>         <set from-field="custRequestDate"
> field="newEntity.custRequestDate"/>
>         <set from-field="statusId" field="newEntity.statusId"/>
>        
> <sequenced-id sequence-name="CustRequest" field="custRequestId"/>
>         <to-string field-name="custRequestId"/>
>         <set from-field="custRequestId" field="newEntity.custRequestId"/>
>         <create-value value-field="newEntity"/>
>         <field-to-result field="custRequestId" map-name="newEntity"/>
>
>     </simple-method>
>
>
> When i click submit it shows success,however the new record is not reflected
> on my DB when i check ed it from webtools..Need your help ..thnx! :)
>  

Reply | Threaded
Open this post in threaded view
|

Re: Creating a record in database

hairi007
In reply to this post by BJ Freeman

<quote author="BJ Freeman">
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

what does the logs say
what version of ofbiz are you using



How do i check which version? Anyways I've just download the files for development about 1 mth ago.

Thnx
Reply | Threaded
Open this post in threaded view
|

Re: Creating a record in database

hairi007
In reply to this post by BJ Freeman

<quote author="BJ Freeman">
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

what does the logs say
what version of ofbiz are you using

Hi guys, I think i know the problem as to why i cannot create the record.
Eventhough I  created my own entity, in the entitymodel.xml, when i try creating a record from my program, the log shows that it is actually trying to create a record from another table mapping.

How do i change this mapping?
(desparate mode)

hope u guys can help.
Reply | Threaded
Open this post in threaded view
|

Re: Creating a record in database

BJ Freeman
In reply to this post by hairi007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

how did you get the code, through svn?
did you download the trunk or release 4.0.
the logs are in
runtime/logs.
if your running a local copy you can also see the logs in the webtools
section.


hairi007 sent the following on 2/22/2009 8:27 PM:

>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> what does the logs say
> what version of ofbiz are you using
>
>
>
> How do i check which version? Anyways I've just download the files for
> development about 1 mth ago.
>
> Thnx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJoqHcrP3NbaWWqE4RAiblAJ9zR0iHbcih097nWJbZC5//meEOnACgug7k
TGWxTEYW6N+1DWUdfPeibs4=
=8bpt
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: Creating a record in database

BJ Freeman
In reply to this post by hairi007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

there is already support for this entity and service in ofbiz.
so you can extend that entity and add your information then update the
already existing service.
Note: a lot of the entities now use the auto created for CRUD services
so you just update the entity and the service will be created automatically.
or rename your entity and services.

hairi007 sent the following on 2/23/2009 2:22 AM:

>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> what does the logs say
> what version of ofbiz are you using
>
> Hi guys, I think i know the problem as to why i cannot create the record.
> Eventhough I  created my own entity, in the entitymodel.xml, when i try
> creating a record from my program, the log shows that it is actually trying
> to create a record from another table mapping.
>
> How do i change this mapping?
> (desparate mode)
>
> hope u guys can help.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJoqQDrP3NbaWWqE4RAnW7AJwJXNGlxAGShQVSwH9keC6mfxCxMACgzrQA
vaU42TmRoVCgwfajtyqKMU0=
=755N
-----END PGP SIGNATURE-----