Hi, I am getting the below error in the process. I have created a CDT

Hi,

I am getting the below error in the process. I have created a CDT with a field name AirlineID as an Number(Integer). It throws an error when it try to store the value in "Write to Store Entity". Please suggest why the CDT integer type value is not able store in the DataStore Entity. Please note the below CDT syntax.

"Details: An error occurred while trying to convert the given data to the type of the specified entity “AirlineDetailMaster” [id=ed3e7773-2bba-4ae6-87af-ded44c76eb95@14330, type=AirlineDetailMaster (id=5170)] (data store: AirTicketManagement). Value that could not be converted: ActivityClassParameter[name=AirlineID,it=1,v=1] Details: com.appiancorp.core.type.TypeCastException: Invalid Cast: Cannot cast from type 'Number (Integer)' to type 'AirlineDetailMaster': CastInvalid "

<xsd:complexType name="AirlineBooking">
<xsd:sequence>
<xsd:element name="AirlineId" type="xsd:int">
<xsd:annotation>
<xsd:appinf...

OriginalPostID-114466

OriginalPostID-114466

  Discussion posts and replies are publicly visible

  • ...o source="appian.jpa">
                                                                @Id
                                                                @GeneratedValue
                                                      </xsd:appinfo>
    </xsd:annotation>
    </xsd:element>



  • Hi Sudhir, The error says that you are trying to map an integer value to CDT "AirlineDetailMaster", Make sure that you are mapping the integer value to AirlineDetailMaster.AirlineId
  • Thanks Navajith... Datastore Issue is resolved. Now I am geting some other issue related to default value though in the form design I have already set the default value. Could anyone suggest what is the issue out here.?

    Details: An error occurred while trying to write to the entity “AirlineDetailMaster” [id=46c24686-b9ce-4bac-ab8c-b27fbe8fc949@14599, type=AirlineDetailMaster (id=5178)] (data store: AirMaster). Details: org.hibernate.exception.GenericJDBCException: could not insert: [AirlineDetailMasterDT2126]: java.sql.SQLException: Field 'a_id' doesn't have a default value Data: TypedValue[it=5178,v={122,Air India,Standard,232}]

  • I have checked the CDT and did not find any issue in the CDT. Please check the below and let me know if there is syntax error.

    <xsd:complexType name="AirlineDetailMaster">
    <xsd:sequence>
    <xsd:element name="AirlineID" type="xsd:int">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">
                                                      @Id
                                                      @GeneratedValue
                                            </xsd:appinfo>
    </xsd:annotation>
    </xsd:element>
    <xsd:element name="AirlineName" type="xsd:string">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">
                                                                @Column(nullable=true)
                                                      </xsd:appinfo>
    </xsd:annotation>
    </xsd:element>
    <xsd:element name="AirlineType" type="xsd:string">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">
                                                                @Column(nullable=true)
                                                      </xsd:appinfo>
    </xsd:annotation>
    </xsd:element>
    <xsd:element name="AirlineCapacity" nillable="true" type="xsd:int"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>

  • Is it a SQL server DB? If so, is the a_id field set to auto-increment?
  • Yes, its a SQL servers and a_id is not an auto-increment. Need to add manually.
    CDT Syntax :
    <xsd:complexType name="AirlineDetailMaster">
    <xsd:sequence>
    <xsd:element name="AirlineID" type="xsd:int">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">
    @Id
    @GeneratedValue
    </xsd:appinfo>
    </xsd:annotation>
    </xsd:element>
  • If it's not auto-increment, then you probably need to take away the @GeneratedValue annotation from the cdt syntax. Is there a reason why you don't want it auto-incremented?
  • What does the pv that you are passing to the "Write to Store Entity" look like?
  • Have you noticed that the error is taking about field 'a_id' while your primary key is actually AirlineID? It seems that the CDT didn't have the @Id annotation originally and that this model or the data store hasn't been updated to point to the latest version of the CDT in which there's a user-defined primary key instead of the Appian defined a_id. I suggest you review the configuration of your Data Store and map it to AirlineDetailMaster instead of AirlineDetailMaster^1 (where 1 is the previous version number)

  • I have removed @Id and @GeneratedValue annotation and checked latest CDT version and it is mapped with "AirlineDetailMaster". I am not sure why I am getting error is on field "a_id" though I have not mentioned it in the CDT.
    I have attached CDT and Application. Please suggest ...

    AirlineDetailMaster.xsd

    Airline Management.zip