Quantcast

Missing addTo* Method

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Missing addTo* Method

dcwmark
Grails User Forum,

I have checked other Missing addTo* Method postings but none of them quite match the condition I am facing.  May I ask if you could help?

I have;

class CaseRecord {
    /* COLUMNS */
    CaseData caseData
}

class CaseData {
    /* COLUMNS */
   
    static belongsTo = [caseRecord: CaseRecord]
}


class CaseRecordService {
    /* CODES */

   CaseRecord saveCaseRecord( CaseRecord caseRecord, CaseData caseData) {
        caseRecord.addToCaseData(caseData)
   
    . . .
}

I am getting this exception:

groovy.lang.MissingMethodException: No signature of method: static groovy.lang.MissingMethodException.addToCaseData() is applicable for argument types: . . .


May I ask if anybody can help?


Cordially,
Entaro Adun.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Missing addTo* Method

Graeme Rocher-4
Administrator
You caseData property is not a collection or list, so no addTo method
exists for it

Cheers

On Thu, Jun 21, 2012 at 4:46 PM, dcwmark <[hidden email]> wrote:

> Grails User Forum,
>
> I have checked other Missing addTo* Method postings but none of them quite
> match the condition I am facing.  May I ask if you could help?
>
> I have;
>
> class CaseRecord {
>    /* COLUMNS */
>    CaseData caseData
> }
>
> class CaseData {
>    /* COLUMNS */
>
>    static belongsTo = [caseRecord: CaseRecord]
> }
>
>
> class CaseRecordService {
>    /* CODES */
>
>   CaseRecord saveCaseRecord( CaseRecord caseRecord, CaseData caseData) {
>        caseRecord.addToCaseData(caseData)
>
>    . . .
> }
>
> I am getting this exception:
>
> groovy.lang.MissingMethodException: No signature of method: static
> groovy.lang.MissingMethodException.addToCaseData() is applicable for
> argument types: . . .
>
>
> May I ask if anybody can help?
>
>
> Cordially,
> Entaro Adun.
>
>
>
>
>
>
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Missing-addTo-Method-tp4630486.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Missing addTo* Method

dcwmark
Mr. Rocher,

Thank you for your timely reply.  Please, pardon my ignorance.  How can I "assign" caseData to caseRecord in this instance?

I tried this before:

    caseRecord.caseData = caseData
    caseRecord.save(flush: true)

I was getting this exception:

Attempt to insert null into a non-nullable column: column: CASE_RECORD_ID table: CASE_DATA in statement [insert into ...


Cordially,
Daniel Mark.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Missing addTo* Method

longwa
Your example should work. It's basically the same exact scenario as 5.2.1.1 Example B in the docs:


Do either of these tables have assigned keys?

-Aaron

On Thu, Jun 21, 2012 at 11:23 AM, dcwmark <[hidden email]> wrote:
Mr. Rocher,

Thank you for your timely reply.  Please, pardon my ignorance.  How can I
"assign" caseData to caseRecord in this instance?

I tried this before:

   caseRecord.caseData = caseData
   caseRecord.save(flush: true)

I was getting this exception:

Attempt to insert null into a non-nullable column: column: CASE_RECORD_ID
table: CASE_DATA in statement [insert into ...


Cordially,
Daniel Mark.




--
View this message in context: http://grails.1312388.n4.nabble.com/Missing-addTo-Method-tp4630486p4630493.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Missing addTo* Method

dcwmark
Mr. Long,

Example B of 5.2.1.1 is exactly where I "lifted" the code from.  :-)  But I am having the toughest time in trying to save these two domains.

The class CaseRecord has a column caseId that the app assigns a number to but it is *NOT* set up as a primary key.


Cordially,
Entaro Adun.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Missing addTo* Method

longwa
Hmmmm, by default, Grails will assume that CaseRecord has a surrogate key called "id". If you want to use caseId as the primary key of the table, you'll need something like this:

static mapping = {
    id(column: 'caseId', generator: 'assigned')
}

This tells Grails that you 1) want to use a column called caseId instead of just Id and 2) that you will assign the key yourself.

In that case, you should be able to do:

def record = new CaseRecord()
record.id = <case number assigned by the app>
record.caseData = caseData
record.save()

Hopefully I'm not misunderstanding the issue, it's hard to give much more help without seeing the full domain model.

-Aaron

On Thu, Jun 21, 2012 at 12:31 PM, dcwmark <[hidden email]> wrote:
Mr. Long,

Example B of 5.2.1.1 is exactly where I "lifted" the code from.  :-)  But I
am having the toughest time in trying to save these two domains.

The class CaseRecord has a column caseId that the app assigns a number to
but it is *NOT* set up as a primary key.


Cordially,
Entaro Adun.

--
View this message in context: http://grails.1312388.n4.nabble.com/Missing-addTo-Method-tp4630486p4630502.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Missing addTo* Method

dcwmark
Mr. Long,

Actually, I do *not* want to change to use id.  I removed the devDB.script and now it seems the problem is "moved down".  There must have been some kind of caching.  With deleting devDB.script, I am now getting a totally different exception.  


Cordially,
Entaro Adun.

The actual classes are listed below:

@Audited
class FreedomCase extends BaseBean {
    enum ReviewStage {
        OPEN('Open'),
        IN_VIEW('In Review'),
        COMPLETED('Completed')
       
        String descStage
       
        ReviewStage(final String arg) {
            this.descStage = arg
        }
    }

    static searchable = true

    Long idenCase    // !!!! *not* to replace id
    ReviewStage reviewStage
   
    Boolean indrAdvisenReviewRequired = false
    Boolean indrActive = true
    String idenFreedomCompany
   
    AdvisenData advisenData
    PrimaryCaseClassification primaryCaseClassification
    SecondaryCaseClassification secondaryCaseClassification
    FreedomUser freedomUser

    static constraints = {
        idenCase(nullable: false, unique: true)
        reviewStage(nullable: false)
        indrAdvisenReviewRequired(nullable: false)
        indrActive(nullable: false)

        advisenData(nullable: true)
        primaryCaseClassification(nullable: true)
        secondaryCaseClassification(nullable: true)
        freedomUser(nullable: true)
       
        idenFreedomCompany(nullable: true)
    }

    static hasMany = [litigationDrivers: LitigationDriver]

    static belongsTo = [
        PrimaryCaseClassification,
        SecondaryCaseClassification,
        LitigationDriver,
        FreedomUser
    ]

    static mapping = {
        litigationDrivers cascade: "all-delete-orphan"
    }
}

@Audited
class AdvisenData extends BaseBean {

    static searchable = true
   
    Long idenMASCAD
    String textCaseDescription
    Long idenCIK
    Long idenGVKEY
    String textTicker
    Integer dateFilingYear
    Date dateFiling
    Date dateClassPeriodFrom
    Date dateClassPeriodTo
    Date dateDisposition
    String textLossAnalytic
    Date dateSettlement
    BigDecimal amntGrossSettlement
    BigDecimal amntCaseSettlement
    String textStandfordReference
    String idenISSCase
    String idenDocket
    String nameJudge
    String textSource
    Boolean indrBankruptcy
    Boolean indrDerivative
    Boolean indrII
    Boolean indrPO
    Boolean indrIPO
    Boolean indrLaddering
    Boolean indrIT
    Boolean indrGAAP
    Boolean indrRestatedFinancials
    Boolean indrTenB5
    Boolean indrSection11
    Boolean indrSECAction
    Boolean indrERISA
    String textDivisionGeography
    String textJurisTrigger
    String textStateTrigger
    String nameCourtOfJurisdiction
    String textCaseType
    String textSecondaryClaim
    String textInstitutionalInvest
    String namePlaintiffLawFirm
    String nameDefendantLawFirm
    String nameInsuranceCompany
    BigDecimal amntInsurancePayment
    String nameDefendants
    Date dateDismissal
    String textCaseStatus
    Date dateSettlementDisbursement
    BigDecimal amntSettlementCash
    String amntSettlementNonCash
    String descSettlementAmount
    Date dateObjectDeadline
    Date dateClaimDeadline
    BigDecimal amntSettlementAccountant
    BigDecimal amntSettlementLawFirm
    String nameSettlingDefendants
    BigDecimal amntUnderwritingSettlement
    Long typeIntCase
    Date dateStatusChange
    String textSecondaryCause
    String textProximateCause
    Date dateCreation
    Date dateLastModification
    String textAdvisenStatus
    String textFinalized
    String textAdvisenNotes
    Integer idenSIC
    String descSIC
    Long idenMASCADRelated1
    String descRelated1
    String textRootCause1
    Long idenMASCADRelated2
    String descRelated2
    String textRootCause2
    Long idenNAICSector
    String descNAICSector
    Long idenNAICSubSector
    String descNAICSubSector
    Long idenNAICSIndGroup
    String descNAICSIndGroup
    Long idenNAICSIndustry
    String descNAICSIndustry
    Long idenNAICSNationalIndustty
    String descNAICSNationalIndustty
    Long idenUltimateParent
    Long idenUltimateParentGVKey
    String nameUltimateParent

    static constraints = {
        idenMASCAD(nullable: true)
        textCaseDescription(nullable: true)
        idenCIK(nullable: true)
        idenGVKEY(nullable: true)
        textTicker(nullable: true)
        dateFilingYear(nullable: true)
        dateFiling(nullable: true)
        dateClassPeriodFrom(nullable: true)
        dateClassPeriodTo(nullable: true)
        dateDisposition(nullable: true)
        textLossAnalytic(nullable: true)
        dateSettlement(nullable: true)
        amntGrossSettlement(nullable: true)
        amntCaseSettlement(nullable: true)
        textStandfordReference(nullable: true)
        idenISSCase(nullable: true)
        idenDocket(nullable: true)
        nameJudge(nullable: true)
        textSource(nullable: true)
        indrBankruptcy(nullable: true)
        indrDerivative(nullable: true)
        indrII(nullable: true)
        indrPO(nullable: true)
        indrIPO(nullable: true)
        indrLaddering(nullable: true)
        indrIT(nullable: true)
        indrGAAP(nullable: true)
        indrRestatedFinancials(nullable: true)
        indrTenB5(nullable: true)
        indrSection11(nullable: true)
        indrSECAction(nullable: true)
        indrERISA(nullable: true)
        textDivisionGeography(nullable: true)
        textJurisTrigger(nullable: true)
        textStateTrigger(nullable: true)
        nameCourtOfJurisdiction(nullable: true)
        textCaseType(nullable: true)
        textSecondaryClaim(nullable: true)
        textInstitutionalInvest(nullable: true)
        namePlaintiffLawFirm(nullable: true)
        nameDefendantLawFirm(nullable: true)
        nameInsuranceCompany(nullable: true)
        amntInsurancePayment(nullable: true)
        nameDefendants(nullable: true)
        dateDismissal(nullable: true)
        textCaseStatus(nullable: true)
        dateSettlementDisbursement(nullable: true)
        amntSettlementCash(nullable: true)
        amntSettlementNonCash(nullable: true)
        descSettlementAmount(nullable: true)
        dateObjectDeadline(nullable: true)
        dateClaimDeadline(nullable: true)
        amntSettlementAccountant(nullable: true)
        amntSettlementLawFirm(nullable: true)
        nameSettlingDefendants(nullable: true)
        amntUnderwritingSettlement(nullable: true)
        typeIntCase(nullable: true)
        dateStatusChange(nullable: true)
        textSecondaryCause(nullable: true)
        textProximateCause(nullable: true)
        dateCreation(nullable: true)
        dateLastModification(nullable: true)
        textAdvisenStatus(nullable: true)
        textFinalized(nullable: true)
        textAdvisenNotes(nullable: true)
        idenSIC(nullable: true)
        descSIC(nullable: true)
        idenMASCADRelated1(nullable: true)
        descRelated1(nullable: true)
        textRootCause1(nullable: true)
        idenMASCADRelated2(nullable: true)
        descRelated2(nullable: true)
        textRootCause2(nullable: true)
        idenNAICSector(nullable: true)
        descNAICSector(nullable: true)
        idenNAICSubSector(nullable: true)
        descNAICSubSector(nullable: true)
        idenNAICSIndGroup(nullable: true)
        descNAICSIndGroup(nullable: true)
        idenNAICSIndustry(nullable: true)
        descNAICSIndustry(nullable: true)
        idenNAICSNationalIndustty(nullable: true)
        descNAICSNationalIndustty(nullable: true)
        idenUltimateParent(nullable: true)
        idenUltimateParentGVKey(nullable: true)
        nameUltimateParent(nullable: true)
    }

    static mapping = {
        textCaseDescription type: 'text'
    }

    static belongsTo = FreedomCase
}

Loading...