JPA with EclipseLink, error Entity cannot be cast to Entity, any help?

Hello, I'm currently deploying a JPA project with EclipseLink on a MySQL db, it's been working fine, however, I'm receiving a problem of this type:
java.lang.ClassCastException: beans.Empleado cannot be cast to beans.Empleado
Where Empleado is my Entity, basically the problem happens here, where I store a result from a SQL select into a List and then assign the results into variables, it was working with no problems before, but now, everytime I run the code, the error shows up, and the only way to make it work at least 2 - 3 times, is restarting the Glassfish Server, here's the code:
Query q = em.createNamedQuery("Empleado.findByIdEmpleado");
q.setParameter("idEmpleado", 2);
List<Empleado> listaEmpleado = q.getResultList();
for(Empleado empleado1 : listaEmpleado){
testString = empleado1.getTecnologia();
But as I said, it was working fine before, so I don't think is actually a code problem, I guess the "cast" reference is happening here:
for(Empleado empleado1 : listaEmpleado)
The errors shows up with every function where I make this kind of casting......
As a comment, I have a similar project at home, and I don't have these problems, this is happening on a project at work, but both project are the same, it's just I'm doing this one at work and the other at home, which is working fine, thanks in advanced, have a nice day, I just hope I was clear about this!
Edited by: user3538005 on 08-11-2011 09:08 AM

Hola,
It's quite strange stuff :) Mainly the exception, beans.Empleado cannot be cast to beans.Empleado.
I think it's because of some configuration problem, related to classloader:
EclipseLink has it's own classloader, if your beans.Empleado is loaded by EclipseLink's classloader, and by a different one (default classloader), you will have two beans.Empleado classes in your JVM, and these classes are different, so you cannot cast them :O
so your eclipselink's classloader has its beans.Empleado(1) class, and after executing your query you have a list with the results each of them in beans.Empleado(1).
and your dao class, or whatever, tries to cast the beans.Empleado(1) to the default classloader's beans.Empleado(2).
what did you change in the config when it started not to work?

Similar Messages

  • My calendar will no longer let me add new event or delete them, it comes up with an error saying "cannot save event, no end date set" or "event does not belong to that event store". can anyone help with this?

    my calendar will no longer let me add new event or delete them, it comes up with an error saying "cannot save event, no end date set" or "event does not belong to that event store". can anyone help with this?

    Hi,
    To configure your ODBC DataSource, go to Control Panel ---> DataSources(ODBC) (If you are in a Windows environment).
    Select the tab System DSN. If you have not added your data source, then do so by clicking on the Add button. If you have added the datasource, click on the Configure button to configure it.
    Give the datasource name, then the database name.
    You have to give the hostname, service name and server name. I guess, in most cases, the datasource name and host name will be the same, service name and server name will be the same. If you are using TCP/IP, the protocol will be onsoctcp.
    There will be a file named Services under C:\WINNT\system32\drivers\etc where you have to give the port number for accessing this server.
    It will be like this <service name> <portnumber>/tcp
    Hope this helps...
    best wishes,
    Nish

  • HT1338 ical error pop up, "The server responded with an error". Cannot get it to go away and cant use my ical because of it

    ical error pop up, "The server responded with an error". Cannot get it to go away and cant use my ical because of it

    How are you syncing your contacts?
    Contacts Troubleshooting
    Contacts - Troubleshooting iCloud Contacts

  • HT1657 my rental has reported a download error and cannot be downloaded or deleted - any suggestions?

    my rental has reported a download error and cannot be downloaded or deleted - any suggestions on how to fix it one way or another?

    Hello there, asim01.
    The following Knowledge Base articles offer a few pointers with troubleshooting issues with downloads from iTunes. First thing to try is verifying connectivity to the iTunes Store:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    If the issue is related to an interrupted download:
    iTunes: How to resume interrupted iTunes Store downloads
    http://support.apple.com/kb/ht1725
    Ultimately, if you are still unable to download your purchase, feel free to report the issue using the following information:
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBooks Store purchase
    http://support.apple.com/kb/ht1933
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Hello, i need help i'm doing experiment on ilab i have managed to put my experiment on the platform but when i try to launch it fails with an error 404 that the page not found. any one with idea of what i should do to solve this problem. thank you

    hello, i need help i'm doing experiment on ilab i have managed to put my experiment on the platform but when i try to launch it fails with an error 404 that the page not found. any one with idea of what i should do to solve this problem. thank you

    hey Sally,
    Can you elaborate on the ilab and what you are trying to do? I have found this page to explain error 404, but I am not sure if it directly applies to  you
    http://digital.ni.com/public.nsf/allkb/D0998D3734926FA08625782300016E40?OpenDocument
    Regards,
    A. Zaatari
    National Instruments
    Applications Engineer

  • I get a runtime error when I try to open itunes, any help?

    I get a runtime error when I try to open itunes, any help?

    Go to Control Panel > Add or Remove Programs (Win XP) or Programs and Features (later)
    Remove all of these items in the following order:
    iTunes
    Apple Software Update
    Apple Mobile Device Support (if this won't uninstall move on to the next item)
    Bonjour
    Apple Application Support
    Reboot, download iTunes, then reinstall, either using an account with administrative rights, or right-clicking the downloaded installer and selecting Run as Administrator.
    The uninstall and reinstall process will preserve your iTunes library and settings, but ideally you would back up the library and your other important personal documents and data on a regular basis. See this user tip for a suggested technique.
    Please note:
    Some users may need to follow all the steps in whichever of the following support documents applies to their system. These include some additional manual file and folder deletions not mentioned above.
    HT1925: Removing and Reinstalling iTunes for Windows XP
    HT1923: Removing and reinstalling iTunes for Windows Vista, Windows 7, or Windows 8
    tt2

  • I have two iPads and one is connected to the internet but my other iPad was connected then was not and since then I have not been able to add my internet back onto my iPad it only says cannot connect to the server any help would be great thanks

    I have two iPads and one is connected to the internet but my other iPad was connected then was not and since then I have not been able to add my internet back onto my iPad it only says cannot connect to the server any help would be great thanks

    If you are having WiFi problems it is necessary to isolate whether the problem is with your network or your iPad. Note: Do NOT consider your network to be blameless if some other devices can connect to it.
    First, test your iPad on some other WiFi networks: a friends, Starbucks, Barnes &amp; Noble, etc.
    If it works well there then the problem is probably with your network. Try restarting your WiFi router by removing power for 30 seconds. If that does not help check for a firmware update for your router. If none exists which corrects the problem consider replacing the router.
    If your iPad does not function well on other networks it possibly has a hardware problem. You could try Settings > General > Reset > Reset Network Settings to see if that corrects the problem. If not, contact Apple Support or visit an Apple store for evaluation. They can provide a replacement if your iPad is bad.
    If you need more help please give the make, model, and version of your WiFi router and how you have it configured.

  • Every time i try to update or restore my iPhone 4 (5.1) it tells me a lot of errors and it stuck in recovery mode :/ any help?

    Every time i try to update or restore my iPhone 4 (5.1) it tells me a lot of errors and it stuck in recovery mode :/ any help?

    Well, if you want or need help, it would be a good idea to start with telling us what those errors are.  We're not mind readers.

  • Hi, I have an iMac which I just booted up and have a white screen with a blue folder with a question mark blinking on and off. Any help would be appreciated. Tommy

    Hi, I have an iMac which I just booted up and have a white screen with a blue folder with a question mark blinking on and off. Any help would be appreciated. Tommy

    That means your iMac could not find a system to use for startup.  That may mean the internal hard drive has become faulty, or the hard drive mechanism is fine, but the startup volume ("Macintosh HD" unless you renamed it) may have some type of data corruption that makes it unbootable.
    First, you should try resetting PRAM
    http://support.apple.com/kb/HT1379
    and if that does not help, use this procedure to reset SMC (power management).  If your iMac is from 2008, this is the procedure for Intel (not PowerPC) Macs.
    http://support.apple.com/kb/HT3964
    (This forum category is for "iMac (PPC)," so if this iMac is older (with a PowerPC processor), please post back.)
    Disconnect all peripheral devices.  When you connect it back to power, if you have been using a power strip of some type, try connecting it directly to a wall outlet, by itself (at least initially).  Start up with nothing but the power cord connected, then add only standard mouse and keyboard.  If it works, run it that way for a while. 
    If PRAM and SMC reset have no effect, you should insert your Mac OS X installation disc (for the currently installed system) in the optical drive, and restart with the C key held down.  This should get you to the Installer screen, where you can run Disk Utility from the Utilities menu. 
    In Disk Utility, does the internal hard drive appear in the sidebar?  If so, select Macintosh HD in the sidebar and go to the First Aid tab.  Use Repair Disk.  If an error is found, note if Disk Utility was able to fix it or not.
    You can then quit Disk Utility and attempt to restart normally.

  • Hi, photoshop crashed and the file I was previously working in on the same version says Could not complete your request because the file is not compatible with this version of Photoshop. I'll appreciate any help. Thank you.

    hi, photoshop crashed and the file I was previously working in, on the same version of Photoshop says "Could not complete your request because the file is not compatible with this version of Photoshop." I'll appreciate any help. Thank you.

    CR2 files from which Canon camera?
    Supported cameras are listed here
    Camera Raw plug-in | Supported cameras

  • When I sign in to hotmail, my emails appear then I have errors and the page goes blank. Any help ? I'm on OS X 10.5.8

    when I sign in to hotmail, my emails appear then I have errors and the page goes blank. Any help ? I'm on OS X 10.5.8
    Sorry should have said, when I log in my emails pop up momentarily. Then, it seems as if the pages aren't loading. A message comes up on the bottom left that the pages are loading, then errors occur and nothing happens.
    Thanks

    i tried to access kb.mozillazine.org and the following error message was returned:
    ERROR
    The requested URL could not be retrieved
    While trying to retrieve the URL: http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox
    The following error was encountered:
    * Read Timeout
    The system returned:
    [No Error]
    A Timeout occurred while waiting to read data from the network. The network or server may be down or congested. Please retry your request.
    Your cache administrator is root.
    Generated Tue, 07 Jun 2011 10:04:45 GMT by sunrise-squid.mz.osuosl.org (squid/2.5.STABLE11)
    I have tried to access your link, or just kb.mozillazine.org several times over the past hour without success...

  • HT201413 error 1600 is not solve so pls any help me.

    error 1600 is not solve so pls any help me.
    and contect me.
    pls...........
    thank u

    > How many times have you posted this question by now?
    5 times:
    http://forum.java.sun.com/thread.jspa?threadID=650196
    http://forum.java.sun.com/thread.jspa?threadID=650958
    http://forum.java.sun.com/thread.jspa?threadID=655214
    http://forum.java.sun.com/thread.jspa?threadID=655229
    http://forum.java.sun.com/thread.jspa?threadID=655231

  • I had to replace my hard drive. Need to re-install office and pages and cannot find the cds. Any help will be appreciated

    I had to replace my hard drive. Need to re-install office and pages and cannot find the cds. Any help will be appreciated

    Replacement System Discs can be obtained from Apple's Customer Support - US (800) 767-2775 for a nominal fee. You'll need to have the model and serial number of your Mac available.
    If you're not in the US, you may need to go through the regional Apple Store that serves your location to find the contact number - http://store.apple.com/Catalog/US/Images/intlstoreroutingpage.html
    Or you can purchase the applications from an Apple retail outlet, App Store or the Apple online store.

  • When I try to download apps I get asked to pick 3 security questions to protect my ID . If I pick continue it goes no further. If I pick not now I cannot download the app. Any help

    When I try to download apps I get a message asking me to answer 3 security if I pick continue I then gat asked to pick a question when I click on. This it goes no further.  If I click on 'not now' I cannot download the app. Any help please.  I have had the iPad since Xmas day but this has only just started happening.

    Problem now resolved. Thanks to all who looked

  • Flex SDK error - ImportRecord cannot be cast to DefineFont

    Hello, I'm using the FlexSDK, tried both stable and latest version from svn.
    Trying to Embed a source file into actionscript that is a swf containing an ImportRecord2 field that
    pulls in a font from an external swf to it.
    Gives this error message, works fine if the font is included manually.
    Error: Unable to create source hmt_test_asset.: flash.swf.types.ImportRecord cannot be cast to flash.swf.tags.DefineFont
    [Embed(source='../resources/test.swf')]
    Is this documented and intended behavior?  What could be some possible workarounds for this?
    If this is a bug, do I need to get the smallest possible swf reproducing the error?
    Thanks,
    Robert Peters

    Please file a bug with a small test case.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

Maybe you are looking for