2011-09-15 13 views
9

में इसे टालने के लिए सबसे अच्छी रणनीति मुझे डोमेन क्लास ऑब्जेक्ट को सहेजते समय "ORA-00972: पहचानकर्ता बहुत लंबा" त्रुटि प्राप्त हो रहा है।ओआरए -00 9 72: पहचानकर्ता बहुत लंबा है - Grails

Caused by: org.hibernate.exception.SQLGrammarException: could not initialize a collection: [com.intelligrape.model.Address.studentsForPermanentAddressId#79366215] 

क्या studentsForPermanentAddressId क्षेत्र की लंबाई को कम करने को छोड़कर इस समस्या को हल करने के लिए संभव समाधान हो सकता है। कारण यह है कि यह एक विरासत डेटाबेस तालिका है जिसे मैं बदल नहीं सकता।

संपादित करें: के रूप में रोब Hruska से पूछा गया डोमेन वर्ग विवरण

package com.intelligrape.model 

class Address { 

    String address1 
    String address2 
    String boxNumber 
    String city 
    Long stateLid 
    String province 
    String zipCode 
    Long countryLid 
    Double latitude 
    Double longitude 
    Long radius 

    static hasMany = [studentsForPermanentAddressId: Student, studentsForLocalAddressId: Student] 

static constraints = { 
     address1 nullable: true 
     address2 nullable: true 
     boxNumber nullable: true, size: 1..25 
     city nullable: true, size: 1..30 
     stateLid nullable: true 
     province nullable: true, size: 1..64 
     zipCode nullable: true, size: 1..15 
     countryLid nullable: true 
     latitude nullable: true 
     longitude nullable: true 
     radius nullable: true 
      studentsForPermanentAddressId nullable: true 
      studentsForLocalAddressId nullable: true 
    } 
} 
+0

यह दिलचस्प है, ओरेकल की लंबाई सीमा 30 है, और 'छात्र फॉरपेरेंटेंट एड्रेसआईडी' "केवल" में 2 9 वर्ण हैं। – NullUserException

+0

@NullUserException - मुझे नहीं लगता कि 'studentsForPermanentAddressId' वास्तविक डेटाबेस कॉलम का नाम है; यह शायद 'students_for_permanent _...' जैसी किसी चीज़ पर मैपिंग कर रहा है। –

+0

@ मोहम्मद - क्या आप डोमेन क्लास कोड प्रदान कर सकते हैं जो प्रश्न में रिश्ते को परिभाषित कर रहा है? –

उत्तर

5

एक मानचित्रण ब्लॉक और मौजूदा स्तंभ मैपिंग जोड़ें:

package com.intelligrape.model 

class Address { 

    String address1 
    String address2 
    String boxNumber 
    String city 
    Long stateLid 
    String province 
    String zipCode 
    Long countryLid 
    Double latitude 
    Double longitude 
    Long radius 

    static hasMany = [studentsForPermanentAddressId: Student, studentsForLocalAddressId: Student] 
    static mappings = { 
     studentsForPermanentAddressId(column: 'stud_perm_addr_id') 
    } 
    static constraints = { 
     address1 nullable: true 
     address2 nullable: true 
     boxNumber nullable: true, size: 1..25 
     city nullable: true, size: 1..30 
     stateLid nullable: true 
     province nullable: true, size: 1..64 
     zipCode nullable: true, size: 1..15 
     countryLid nullable: true 
     latitude nullable: true 
     longitude nullable: true 
     radius nullable: true 
      studentsForPermanentAddressId nullable: true 
      studentsForLocalAddressId nullable: true 
    } 
} 

एक अलग रूप में के रूप में, अगर यह एक नहीं थे विरासत डेटाबेस आप इस प्रोजेक्ट का उपयोग कर सकते हैं: http://code.google.com/p/hibernate-naming-strategy-for-oracle/

शुरुआत से सही मैपिंग उत्पन्न करने के लिए।

संबंधित मुद्दे

 संबंधित मुद्दे