Issue Details (XML | Word | Printable)

Key: GRAILS-2032
Type: Bug Bug
Status: Resolved Resolved
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Graeme Rocher
Reporter: Ricardo J. Méndez
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Grails

Association refers to an unmapped class

Created: 12/Dec/07 04:19 PM   Updated: 19/Nov/08 09:51 AM
Component/s: Persistence
Affects Version/s: 1.0-RC3
Fix Version/s: 1.0.4

Time Tracking:
Not Specified

File Attachments: 1. Text File Stacktrace.txt (904 kB)



 Description  « Hide
More and more often I've been getting exceptions from Grails RC2 and RC3 regarding an 'unmapped class'. Doing a grails clean solves the problem, but it would seem something's wrong for it to appear so often.

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table customer_note refers to an unmapped class: Customer

I'll add the full stack trace ad an attachment.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Ricardo J. Méndez added a comment - 12/Dec/07 04:21 PM
Full exception stack trace.

Graeme Rocher added a comment - 24/Mar/08 05:28 PM
please attach a sample with steps to reproduce

Ricardo J. Méndez added a comment - 24/Mar/08 10:07 PM
Haven't gotten this issue in 1.0.1 at all.

Pam added a comment - 29/Apr/08 12:01 PM
Hi, I'm still got this issue and grails clean doesn't fix it. I had to go in manually and delete a bunch of *.class files in the project directory. I think they were something that Eclipse created when I imported the project. I had checked "Disable Groovy compiler generating class files" but sometimes it still does it when I import a project.

Deleting the .class files, and then doing grails clean fixed this for me.


Matthias added a comment - 12/May/08 08:38 AM
I just had this same issue with grails-1.0.3-SNAPSHOT.

grails-clean alone did not help; I then did a Project --> clean in Eclipse followed by a grails clean. That did the job. Don't think it's a grails bug; much more one of the myriads of issues related to developing a Grails app using Eclipse... the Eclipse support is really extremely poor.


Alberto Brandolini added a comment - 03/Jul/08 05:24 PM
Same situation, deleting .class files from within Eclipse solved the problem.

I made 2 mistakes before that are maybe related to the root cause:
1) a typo while creating a controller so I had 2 controller classes for the same class, which was the one pointing to the apparently unmapped class
2) i declared in class A an attribute of type B without the 'static belongsTo = A', then I added it, but was too late.

I think it's related to 2) I'll try to isolate the conditions.


Matthias added a comment - 14/Nov/08 10:37 AM
This is actually very easy to reproduce: I get this error everytime when I "grails run-app" after I changed something in a domain class and did not do a full clean and package thereafter.

I always have to clean and rebuild everything when changing even the slightest thing in a domain class.

This should be reopened, as it is extremely annoying and time consuming.


Graeme Rocher added a comment - 14/Nov/08 02:22 PM
attach an example with steps to reproduce please

Matthias added a comment - 19/Nov/08 09:51 AM
Well, it happens in any of my domain classes, whenever I modify code there... So the example is:
1) Create domain class
2) start server
3) everything OK
4) stop server
5) modify domain class
6) start server
7) exception occurs (see bug report)
8) grails clean && grails package
9) start server
10) everything works again

I suppose it doesn't happen with your setup, otherwise you had already gone nuts like me
But having to rebuild the entire project after every tiny weeny change in a domain class is... well... not cool.

I'm sorry if I cannot give you better input, I can just say that the problem is there, and I had it from day one (that's roughly six months now).