<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    JPA Project - cannot resolve tables
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/cdreyer1">Claus Dreyer</a> in <i>JBoss Tools</i> - <a href="http://community.jboss.org/message/580153#580153">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have a simple project made with the 'JPA Project' wizard. My development setup is Eclipse 3.6 Helios, JBoss Tools 3.2.CR1 and MySQL 5.5.8. Everything is running on Windows.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The problem is that I get the error <strong>Table "MyEntity" cannot be resolved</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The entity class MyEntity is a very simple test class. The corresponding table was created with a DDL file made by the JPA Tools -&gt; Generate Tables from Entities... wizard.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have tried many things to get it to work. I finally made an entity class called lowercase (all of the letters are lower case), and suddenly it worked...</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>It seems that the tools (I don't know if it is JBoss Tools or Dali) does a case sensitive comparison on the class name and table name. By default MySQL on Windows converts all table names to lower case. This is not the case for column names where lettercase is preserved. On Unix (and Mac I believe) lettercase is preserved by default by MySQL.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>MySQL has a global system variable called <em>lower_case_table_names</em> (see MySQL doc: <a class="jive-link-external-small" href="http://dev.mysql.com/doc/refman/5.5/en/identifier-case-sensitivity.html">Identifier Case Sensitivity</a>). According to the MySQL documentation it can be set to 2 (instead of 1) and lettercase will be preserved on Windows. However, this has implications for your database statements which now must have the correct lettercase.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have tried to start MySQL with lower_case_table_names=2, then drop the existing database, re-create the database, run the DDL for my two simple classes mentioned above and then the tools work.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I don't know if this issue should be classified as a bug or just filed on quirks related to MySQL.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Kind regards,</p><p>Claus</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/580153#580153">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Tools at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>