Need help Error: org.hibernate.exception.ConstraintViolationException: could not insert - 02345100

Forum for users and developers of Bullhorn's Webservices API suite

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
bsienn
User
Posts: 2
Joined: Tue Oct 04, 2016 1:26 pm

Need help Error: org.hibernate.exception.ConstraintViolationException: could not insert - 02345100

Post by bsienn » Tue Oct 04, 2016 1:37 pm

Please guide me what could be wrong. I'm new to this API and facing an issue on adding new project. I get the following error:
org.hibernate.exception.ConstraintViolationException: could not insert: [com.bullhorn.entity.history.JobOrderHistory]

Below is the XML

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ns1="http://job.entity.bullhorn.com/"
    xmlns:ns2="http://query.apiservice.bullhorn.com/"
    xmlns:ns3="http://apiservice.bullhorn.com/">
    <SOAP-ENV:Body>
        <ns3:save xsi:type="ns2:save">
            <session>
                <client>client-key-goes-here</client>
                <corporationId>9454</corporationId>
                <userId>2</userId>
            </session>
            <dto xsi:type="ns1:jobOrderDto">
                <address/>
                <benefits></benefits>
                <billRateCategoryID>0</billRateCategoryID>
                <bonusPackage></bonusPackage>
                <branchCode></branchCode>
                <certificationList></certificationList>
                <clientBillRate></clientBillRate>
                <clientContactID>24656</clientContactID>
                <clientCorporationID>9454</clientCorporationID>
                <costCenter></costCenter>
                <customText1>http://www.sclpl.io/app/apis/1.0/avatars/57f3db403920a_black-cat.jpg</customText1>
                <dateAdded xsi:type="xsd:datetime">2016-10-04T09:39:28-07:00</dateAdded>
                <dateClosed></dateClosed>
                <dateEnd xsi:type="xsd:datetime">2016-11-11T00:00:00-08:00</dateEnd>
                <dateLastExported></dateLastExported>
                <degreeList></degreeList>
                <description>NA</description>
                <durationWeeks>0</durationWeeks>
                <educationDegree></educationDegree>
                <employmentType>permanent</employmentType>
                <externalCategoryID>0</externalCategoryID>
                <externalID></externalID>
                <feeArrangement>0</feeArrangement>
                <hoursOfOperation></hoursOfOperation>
                <hoursPerWeek>0</hoursPerWeek>
                <isDeleted>false</isDeleted>
                <isInterviewRequired>false</isInterviewRequired>
                <isJobcastPublished>false</isJobcastPublished>
                <isOpen>true</isOpen>
                <isPublic>1</isPublic>
                <jobBoardList></jobBoardList>
                <numOpenings>10</numOpenings>
                <optionsPackage></optionsPackage>
                <ownerID>2</ownerID>
                <payRate></payRate>
                <reasonClosed></reasonClosed>
                <reportTo></reportTo>
                <reportToClientContactID>0</reportToClientContactID>
                <salaryUnit></salaryUnit>
                <startDate xsi:type="xsd:datetime">2016-10-10T00:00:00-07:00</startDate>
                <status>Accepting Candidates</status>
                <taxRate>0</taxRate>
                <taxStatus></taxStatus>
                <title>test</title>
                <travelRequirements></travelRequirements>
                <willRelocate>false</willRelocate>
                <willSponsor>false</willSponsor>
                <workersCompRateID>0</workersCompRateID>
                <yearsRequired>0</yearsRequired>
            </dto>
        </ns3:save>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

dfilla
User
Posts: 13
Joined: Mon May 16, 2016 2:01 pm

Re: Need help Error: org.hibernate.exception.ConstraintViolationException: could not insert - 02345100

Post by dfilla » Thu Oct 06, 2016 10:47 am

Hello bsienn,

This is David with Bullhorn Support. After testing this on my end, I was able to get this record to successfully save. there do seem to be a few errors in the XML you provided.

First, the <session> section should only include the session key, you should not need to specify the corporation or userId in that section. Each session key is specific to a database, so it will specify which corporation you are adding this jobOrder for.

Additionally, when I was able to get this to successfully save, it was still not displaying in the list, however, I was able to find the record by checking jobs associated with the contact 24656. When I checked the job record, it was missing the ClientCorporation field. The value you have in that field is the corporation ID for the database, and is not a company record ID in the system. This would need to be attached to a company in the system, as that field is required.

Making these changes should allow the save to go through properly. I hope this helps. Let me know if you have any further questions or concerns.

Thanks,

bsienn
User
Posts: 2
Joined: Tue Oct 04, 2016 1:26 pm

Re: Need help Error: org.hibernate.exception.ConstraintViolationException: could not insert - 02345100

Post by bsienn » Thu Oct 06, 2016 1:52 pm

Hi David, thanks for your detailed reply.
I'll test the changes you mention to get it working and If I get in problem I'll post back here.

Thanks again for your time. Appreciate :)

Post Reply