Discussion:
ORA-00972: identifier is too long - Best strategy to avoid it in Grails
Mohd Farid
2011-09-15 14:32:36 UTC
Permalink
Hi all

I am getting "ORA-00972: identifier is too long" error while saving a domain
class object.

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

What could be the possible solutions to solve this problem except reducing
the length of studentsForPermanentAddressId field. The reason being, this is
a legacy database table which I can not alter.

Thanks & Regards
Mohd Farid
Rob Elsner
2011-09-15 14:55:18 UTC
Permalink
If this is a legacy database, then the object names must already be
the correct length.

I would guess you are missing a mapping to the existing column name,
so Grails is trying to generate its own mapping.

static mappings = {
studentsForPermanentAddressId column: 'stud_addr_id'
}

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

http://xircles.codehaus.org/manage_email
Gaurav Chauhan
2011-09-15 15:12:40 UTC
Permalink
I got this error while working with Oracle database. Only way out was to
define the mapping as explained by Rob.

Regards
Gaurav Chauhan
Post by Rob Elsner
If this is a legacy database, then the object names must already be
the correct length.
I would guess you are missing a mapping to the existing column name,
so Grails is trying to generate its own mapping.
static mappings = {
studentsForPermanentAddressId column: 'stud_addr_id'
}
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Mohd Farid
2011-09-16 05:58:17 UTC
Permalink
Thanks a lot Rob and Gaurav. You are right, the legacy database already had
smaller names. I just had to map it with my longer name.

Thanks & Regards
Mohd Farid
Post by Gaurav Chauhan
I got this error while working with Oracle database. Only way out was to
define the mapping as explained by Rob.
Regards
Gaurav Chauhan
Post by Rob Elsner
If this is a legacy database, then the object names must already be
the correct length.
I would guess you are missing a mapping to the existing column name,
so Grails is trying to generate its own mapping.
static mappings = {
studentsForPermanentAddressId column: 'stud_addr_id'
}
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Gaurav Chauhan
2011-09-16 06:03:45 UTC
Permalink
Glad it worked for you. :-)

Regards
Gaurav Chauhan
Post by Mohd Farid
Thanks a lot Rob and Gaurav. You are right, the legacy database already had
smaller names. I just had to map it with my longer name.
Thanks & Regards
Mohd Farid
Post by Gaurav Chauhan
I got this error while working with Oracle database. Only way out was to
define the mapping as explained by Rob.
Regards
Gaurav Chauhan
Post by Rob Elsner
If this is a legacy database, then the object names must already be
the correct length.
I would guess you are missing a mapping to the existing column name,
so Grails is trying to generate its own mapping.
static mappings = {
studentsForPermanentAddressId column: 'stud_addr_id'
}
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Mohd Farid
2011-09-16 12:55:35 UTC
Permalink
Hi Rob

Just in case you are on stackoverflow. I have posted this question
athttp://stackoverflow.com/questions/7432501/ora-00972-identifier-is-too-long-best-strategy-to-avoid-it-in-grails


I would be happy to accept your answer there as well.

Thanks & Regards
Mohd Farid
Post by Gaurav Chauhan
Glad it worked for you. :-)
Regards
Gaurav Chauhan
Post by Mohd Farid
Thanks a lot Rob and Gaurav. You are right, the legacy database already
had smaller names. I just had to map it with my longer name.
Thanks & Regards
Mohd Farid
Post by Gaurav Chauhan
I got this error while working with Oracle database. Only way out was to
define the mapping as explained by Rob.
Regards
Gaurav Chauhan
Post by Rob Elsner
If this is a legacy database, then the object names must already be
the correct length.
I would guess you are missing a mapping to the existing column name,
so Grails is trying to generate its own mapping.
static mappings = {
studentsForPermanentAddressId column: 'stud_addr_id'
}
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Loading...