<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> 
        <base href="https://hibernate.atlassian.net"> 
        <title>Message Title</title> 
    </head> 
    <body class="jira" style="color: #333333; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.429"> 
        <table id="background-table" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; background-color: #f5f5f5; border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0" bgcolor="#f5f5f5"> 
            <!-- header here --> 
            <tbody>
                <tr> 
                    <td id="header-pattern-container" style="padding: 0; border-collapse: collapse; padding: 10px 20px"> 
                        <table id="header-pattern" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                            <tbody>
                                <tr> 
                                    <td id="header-avatar-image-container" valign="top" style="padding: 0; border-collapse: collapse; vertical-align: top; width: 32px; padding-right: 8px" width="32"> <img id="header-avatar-image" class="image_fix" src="https://avatar-cdn.atlassian.com/179f551e61059d530b7c0e990d83f1c5?s=48&amp;d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F179f551e61059d530b7c0e990d83f1c5%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue" height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top"> </td> 
                                    <td id="header-text-container" valign="middle" style="padding: 0; border-collapse: collapse; vertical-align: middle; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> <a class="user-hover" rel="danis.tazeev" id="email_danis.tazeev" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=danis.tazeev" style="color:#6c797f;; color: #3b73af; text-decoration: none">Дани́с Тазеев</a> <strong>created</strong> an issue </td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
                <tr> 
                    <td id="email-content-container" style="padding: 0; border-collapse: collapse; padding: 0 20px"> 
                        <table id="email-content-table" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; border-spacing: 0; border-collapse: separate"> 
                            <tbody>
                                <tr> 
                                    <!-- there needs to be content in the cell for it to render in some clients --> 
                                    <td class="email-content-rounded-top mobile-expand" style="padding: 0; border-collapse: collapse; color: #ffffff; padding: 0 15px 0 16px; height: 15px; background-color: #ffffff; border-left: 1px solid #cccccc; border-top: 1px solid #cccccc; border-right: 1px solid #cccccc; border-bottom: 0; border-top-right-radius: 5px; border-top-left-radius: 5px; height: 10px; line-height: 10px; padding: 0 15px 0 16px; mso-line-height-rule: exactly" height="10" bgcolor="#ffffff">&nbsp;</td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand " style="padding: 0; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff" bgcolor="#ffffff"> 
                                        <table class="page-title-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                                            <tbody>
                                                <tr> 
                                                    <td class="page-title-pattern-first-line " style="padding: 0; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; padding-top: 10px"> <a href="https://hibernate.atlassian.net/browse/HHH" style="color: #3b73af; text-decoration: none">Hibernate ORM</a> / <a href="https://hibernate.atlassian.net/browse/HHH-12265" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-avatar-ff302d74-f1d5-458f-8648-c809607762a8" height="16" width="16" border="0" align="absmiddle" alt="Bug" style="vertical-align: text-bottom"></a> <a href="https://hibernate.atlassian.net/browse/HHH-12265" style="color: #3b73af; text-decoration: none">HHH-12265</a> </td> 
                                                </tr> 
                                                <tr> 
                                                    <td style="vertical-align: top;; padding: 0; border-collapse: collapse; padding-right: 5px; font-size: 20px; line-height: 30px; mso-line-height-rule: exactly" class="page-title-pattern-header-container"> <span class="page-title-pattern-header" style="font-family: Arial, sans-serif; padding: 0; font-size: 20px; line-height: 30px; mso-text-raise: 2px; mso-line-height-rule: exactly; vertical-align: middle"> <a href="https://hibernate.atlassian.net/browse/HHH-12265" style="color: #3b73af; text-decoration: none">Why Hibernate returns null while the same query in Postgres returns a row?</a> </span> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand  wrapper-special-margin" style="padding: 0; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff; padding-top: 10px; padding-bottom: 5px" bgcolor="#ffffff"> 
                                        <table class="keyvalue-table" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                                            <tbody>
                                                <tr> 
                                                    <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">Issue Type:</th> 
                                                    <td class="has-icon" style="padding: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> <img src="cid:jira-generated-image-avatar-ff302d74-f1d5-458f-8648-c809607762a8" height="16" width="16" border="0" align="absmiddle" alt="Bug" style="vertical-align: text-bottom"> Bug </td> 
                                                </tr> 
                                                <tr> 
                                                    <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">Affects Versions:</th> 
                                                    <td style="padding: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> 5.2.12 </td> 
                                                </tr> 
                                                <tr> 
                                                    <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">Assignee:</th> 
                                                    <td style="padding: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> Unassigned </td> 
                                                </tr> 
                                                <tr> 
                                                    <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">Components:</th> 
                                                    <td style="padding: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> hibernate-core </td> 
                                                </tr> 
                                                <tr> 
                                                    <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">Created:</th> 
                                                    <td style="padding: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> 30/Jan/2018 14:41 PM </td> 
                                                </tr> 
                                                <tr> 
                                                    <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">Environment:</th> 
                                                    <td style="padding: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> &lt;version.hibernate&gt;5.2.12.Final&lt;/version.hibernate&gt; <br> <br> java version "1.8.0_161" <br> Java(TM) SE Runtime Environment (build 1.8.0_161-b12) <br> Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode) <br> <br> MS Windows 10 <br> <br> PostgreSQL 10.1 </td> 
                                                </tr> 
                                                <tr> 
                                                    <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">Labels:</th> 
                                                    <td style="padding: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> jpa21 </td> 
                                                </tr> 
                                                <tr> 
                                                    <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">Priority:</th> 
                                                    <td class="has-icon" style="padding: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> <img src="cid:jira-generated-image-static-major-ac097eb8-a928-4891-ac56-dd8ad68dd480" height="16" width="16" border="0" align="absmiddle" alt="Major" style="vertical-align: text-bottom"> Major </td> 
                                                </tr> 
                                                <tr> 
                                                    <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">Reporter:</th> 
                                                    <td style="padding: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> <a class="user-hover" rel="danis.tazeev" id="email_danis.tazeev" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=danis.tazeev" style="color:#6c797f;; color: #3b73af; text-decoration: none">Дани́с Тазеев</a> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand  issue-description-container" style="padding: 0; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff; padding-top: 5px; padding-bottom: 10px" bgcolor="#ffffff"> 
                                        <table class="text-paragraph-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 2px"> 
                                            <tbody>
                                                <tr> 
                                                    <td class="text-paragraph-pattern-container mobile-resize-text " style="padding: 0; border-collapse: collapse; padding: 0 0 10px"> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0; margin-top: 0">I had a hard time to make my JUnit test working. Here are the code snippets. The first is my superclass:</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
@MappedSuperclass
<span class="code-keyword" style="color: #000091">abstract</span> <span class="code-keyword" style="color: #000091">class </span>IdentifiedEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    <span class="code-keyword" style="color: #000091">private</span> <span class="code-object" style="color: #910091">int</span> id;
    ...
}
</pre> 
                                                            </div>
                                                        </div> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">Then there are two descendeants:</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
@Entity
@Table(name = <span class="code-quote" style="color: #009100">"\"</span>user\"")
@AttributeOverride(name = <span class="code-quote" style="color: #009100">"id"</span>, column = @Column(name = <span class="code-quote" style="color: #009100">"user_id"</span>))
<span class="code-keyword" style="color: #000091">public</span> <span class="code-keyword" style="color: #000091">class </span>User <span class="code-keyword" style="color: #000091">extends</span> IdentifiedEntity {
    ...
}
</pre> 
                                                            </div>
                                                        </div> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">and</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
@Entity
@Table(name = <span class="code-quote" style="color: #009100">"meal"</span>)
@AttributeOverride(name = <span class="code-quote" style="color: #009100">"id"</span>, column = @Column(name = <span class="code-quote" style="color: #009100">"meal_id"</span>))
<span class="code-keyword" style="color: #000091">public</span> <span class="code-keyword" style="color: #000091">class </span>Meal <span class="code-keyword" style="color: #000091">extends</span> IdentifiedEntity {
    @ManyToOne(optional = <span class="code-keyword" style="color: #000091">false</span>)
    @JoinColumn(name = <span class="code-quote" style="color: #009100">"user_id"</span>)
    <span class="code-keyword" style="color: #000091">private</span> <span class="code-keyword" style="color: #000091">final</span> User user;
    ...
    @Override
    <span class="code-keyword" style="color: #000091">public</span> <span class="code-object" style="color: #910091">String</span> toString() {
        <span class="code-keyword" style="color: #000091">return</span> getClass().getSimpleName() + <span class="code-quote" style="color: #009100">'#'</span> + getId() + <span class="code-quote" style="color: #009100">"U#"</span> + user.getId()
                + <span class="code-quote" style="color: #009100">':'</span> + desc + <span class="code-quote" style="color: #009100">'@'</span> + when + <span class="code-quote" style="color: #009100">'×'</span> + calories;
    }
}
</pre> 
                                                            </div>
                                                        </div> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">Here is an excerpt of the script, creating the DB in PostgreSQL:</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-sql" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
<span class="code-keyword" style="color: #000091">create</span> <span class="code-keyword" style="color: #000091">table</span> <span class="code-quote" style="color: #009100">"<span class="code-keyword" style="color: #000091; color: #009100">user</span>"</span> (
  user_id serial <span class="code-keyword" style="color: #000091">primary</span> <span class="code-keyword" style="color: #000091">key</span>,
  ...
);
<span class="code-keyword" style="color: #000091">create</span> <span class="code-keyword" style="color: #000091">table</span> meal (
  meal_id serial <span class="code-keyword" style="color: #000091">primary</span> <span class="code-keyword" style="color: #000091">key</span>,
  user_id <span class="code-keyword" style="color: #000091">int</span> <span class="code-keyword" style="color: #000091">not</span> <span class="code-keyword" style="color: #000091">null</span> <span class="code-keyword" style="color: #000091">references</span> <span class="code-quote" style="color: #009100">"<span class="code-keyword" style="color: #000091; color: #009100">user</span>"</span>(user_id),
  ...
);
</pre> 
                                                            </div>
                                                        </div> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">And finally the test case^</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
@ContextConfiguration(<span class="code-quote" style="color: #009100">"classpath:/spring/spring-app.xml"</span>)
@Sql(<span class="code-quote" style="color: #009100">"classpath:/db/refill.sql"</span>)
@RunWith(SpringRunner.class)
@Transactional(REQUIRED)
<span class="code-keyword" style="color: #000091">public</span> <span class="code-keyword" style="color: #000091">class </span>JpaMealRepositoryImplTest {
    @Test
    <span class="code-keyword" style="color: #000091">public</span> void updateWithValidMeal() <span class="code-keyword" style="color: #000091">throws</span> Exception {
        meal.setId(ID_MEAL_ADMINS);
        repo.update(meal);
    }
}
</pre> 
                                                            </div>
                                                        </div> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">The <tt>repo</tt> is</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
@Repository
<span class="code-keyword" style="color: #000091">public</span> <span class="code-keyword" style="color: #000091">final</span> <span class="code-keyword" style="color: #000091">class </span>JpaMealRepositoryImpl <span class="code-keyword" style="color: #000091">implements</span> MealRepository {
    @Override
    <span class="code-keyword" style="color: #000091">public</span> void update(Meal meal) <span class="code-keyword" style="color: #000091">throws</span> NotFoundException {
        log.info(<span class="code-quote" style="color: #009100">"update({})"</span>, meal);
        Preconditions.checkArgument(!meal.isNew(), <span class="code-quote" style="color: #009100">"<span class="code-keyword" style="color: #000091; color: #009100">new</span>"</span>);
        Meal m = em.find(Meal.class, meal.getId());
        log.debug(<span class="code-quote" style="color: #009100">"m={}"</span>, m);
        <span class="code-keyword" style="color: #000091">if</span> (m == <span class="code-keyword" style="color: #000091">null</span> || m.getUser().getId() != meal.getUser().getId()) {
            <span class="code-keyword" style="color: #000091">throw</span> <span class="code-keyword" style="color: #000091">new</span> NotFoundException(<span class="code-quote" style="color: #009100">"mealId="</span> + meal.getId() + <span class="code-quote" style="color: #009100">"; userId="</span> + meal.getUser().getId());
        }
        m.setWhen(meal.getWhen());
        m.setDesc(meal.getDesc());
        m.setCalories(meal.getCalories());
    }
}
</pre> 
                                                            </div>
                                                        </div> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">Now here is the log:</p> 
                                                        <div class="preformatted panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="preformattedContent panelContent" style="padding: 9px 12px"> 
                                                                <pre style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal; white-space: pre; word-break: normal; word-wrap: break-word; word-break: break-all; white-space: pre-wrap">190216.874 I main/JpaMealRepositoryImpl - update(Meal#4U#1:Перекус@2018-01-26T19:02×300)
Hibernate: 
    select
        meal0_.meal_id as id1_0_0_,
        meal0_.calories as calories2_0_0_,
        meal0_."desc" as desc3_0_0_,
        meal0_.user_id as user_id5_0_0_,
        meal0_."when" as when4_0_0_,
        user1_.user_id as id1_1_1_,
        user1_.admin as admin2_1_1_,
        user1_.calories_per_day_limit as calories3_1_1_,
        user1_.email as email4_1_1_,
        user1_.enabled as enabled5_1_1_,
        user1_.name as name6_1_1_,
        user1_.password as password7_1_1_,
        user1_.registered_at as register8_1_1_ 
    from
        meal meal0_ 
    inner join
        "user" user1_ 
            on meal0_.user_id=user1_.user_id 
    where
        meal0_.meal_id=?
190216.877 D main/JpaMealRepositoryImpl - m=null

ru.javawebinar.topjava.repository.NotFoundException: mealId=4; userId=1

    at ru.javawebinar.topjava.repository.jpa.JpaMealRepositoryImpl.update(JpaMealRepositoryImpl.java:38)
    at ru.javawebinar.topjava.repository.jpa.JpaMealRepositoryImplTest.updateWithValidMeal(JpaMealRepositoryImplTest.java:61)
...
</pre> 
                                                            </div>
                                                        </div> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">The question is: <b>Why</b> <tt>190216.877 D main/JpaMealRepositoryImpl - m=null</tt>?</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">If I run this query in Postgres, replacing the <tt>?</tt> with the <tt>meal_id</tt> (which is <tt>4</tt> as seen in the log), then I get a row. Just a single row as I wanted. Why <tt>em.find(...)</tt> returns <tt>null</tt>?</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">I fill the DB with the <tt>refill.sql</tt> script on start of each test-class:</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
@Sql(<span class="code-quote" style="color: #009100">"classpath:/db/refill.sql"</span>)
</pre> 
                                                            </div>
                                                        </div> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">Here is the qwery I issue in <tt>psql</tt>:</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-sql" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
<span class="code-keyword" style="color: #000091">select</span>
    meal0_.meal_id <span class="code-keyword" style="color: #000091">as</span> id1_0_0_,
    meal0_.calories <span class="code-keyword" style="color: #000091">as</span> calories2_0_0_,
    meal0_.<span class="code-quote" style="color: #009100">"<span class="code-keyword" style="color: #000091; color: #009100">desc</span>"</span> <span class="code-keyword" style="color: #000091">as</span> desc3_0_0_,
    meal0_.user_id <span class="code-keyword" style="color: #000091">as</span> user_id5_0_0_,
    meal0_.<span class="code-quote" style="color: #009100">"<span class="code-keyword" style="color: #000091; color: #009100">when</span>"</span> <span class="code-keyword" style="color: #000091">as</span> when4_0_0_,
    user1_.user_id <span class="code-keyword" style="color: #000091">as</span> id1_1_1_,
    user1_.<span class="code-keyword" style="color: #000091">admin</span> <span class="code-keyword" style="color: #000091">as</span> admin2_1_1_,
    user1_.calories_per_day_limit <span class="code-keyword" style="color: #000091">as</span> calories3_1_1_,
    user1_.email <span class="code-keyword" style="color: #000091">as</span> email4_1_1_,
    user1_.enabled <span class="code-keyword" style="color: #000091">as</span> enabled5_1_1_,
    user1_.<span class="code-keyword" style="color: #000091">name</span> <span class="code-keyword" style="color: #000091">as</span> name6_1_1_,
    user1_.<span class="code-keyword" style="color: #000091">password</span> <span class="code-keyword" style="color: #000091">as</span> password7_1_1_,
    user1_.registered_at <span class="code-keyword" style="color: #000091">as</span> register8_1_1_ 
    <span class="code-keyword" style="color: #000091">from</span>
        meal meal0_ 
    <span class="code-keyword" style="color: #000091">inner</span> <span class="code-keyword" style="color: #000091">join</span>
        <span class="code-quote" style="color: #009100">"<span class="code-keyword" style="color: #000091; color: #009100">user</span>"</span> user1_ 
            <span class="code-keyword" style="color: #000091">on</span> meal0_.user_id=user1_.user_id 
    <span class="code-keyword" style="color: #000091">where</span>
        meal0_.meal_id=4;
</pre> 
                                                            </div>
                                                        </div> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">The result is</p> 
                                                        <div class="preformatted panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="preformattedContent panelContent" style="padding: 9px 12px"> 
                                                                <pre style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal; white-space: pre; word-break: normal; word-wrap: break-word; word-break: break-all; white-space: pre-wrap">4|400|Завтрак|1|2017-12-11 10:00:00|1|t|2000|admin@example.com|t|Admin|\x21232f297a57a5a743894a0e4a801fc3|2018-01-26 22:37:08.326818+00
</pre> 
                                                            </div>
                                                        </div> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand " style="padding: 0; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff" bgcolor="#ffffff"> <script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "description": "View Issue",
  "potentialAction": {
    "@type": "ViewAction",
        "target": "https://hibernate.atlassian.net/browse/HHH-12265?inbox=true&",
    "name": "View Issue"
      },
  "publisher": {
    "@type": "Organization",
    "name": "Atlassian",
    "url": "https://www.atlassian.com"
  }
}
</script> 
                                        <table id="actions-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> 
                                            <tbody>
                                                <tr> 
                                                    <td id="actions-pattern-container" valign="middle" style="padding: 0; border-collapse: collapse; padding: 10px 0 10px 24px; vertical-align: middle; padding-left: 0"> 
                                                        <table align="left" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                                                            <tbody>
                                                                <tr> 
                                                                    <td class="actions-pattern-action-icon-container" style="padding: 0; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0; vertical-align: middle"> <a href="https://hibernate.atlassian.net/browse/HHH-12265#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none"> <img class="actions-pattern-action-icon-image" src="cid:jira-generated-image-static-comment-icon-50d939cc-4f96-4c01-abda-08003b8e6067" alt="Add Comment" title="Add Comment" height="16" width="16" border="0" style="vertical-align: middle"> </a> </td> 
                                                                    <td class="actions-pattern-action-text-container" style="padding: 0; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px"> <a href="https://hibernate.atlassian.net/browse/HHH-12265#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none">Add Comment</a> </td> 
                                                                </tr> 
                                                            </tbody>
                                                        </table> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <!-- there needs to be content in the cell for it to render in some clients --> 
                                <tr> 
                                    <td class="email-content-rounded-bottom mobile-expand" style="padding: 0; border-collapse: collapse; color: #ffffff; padding: 0 15px 0 16px; height: 5px; line-height: 5px; background-color: #ffffff; border-top: 0; border-left: 1px solid #cccccc; border-bottom: 1px solid #cccccc; border-right: 1px solid #cccccc; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; mso-line-height-rule: exactly" height="5" bgcolor="#ffffff">&nbsp;</td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
                <tr> 
                    <td id="footer-pattern" style="padding: 0; border-collapse: collapse; padding: 12px 20px"> 
                        <table id="footer-pattern-container" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                            <tbody>
                                <tr> 
                                    <td id="footer-pattern-mobile-separated-links" class="mobile-resize-text" width="100%" colspan="2" style="padding: 0; border-collapse: collapse; color: #999999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px"> Get Jira notifications on your phone! Download the Jira Cloud app for <a href="https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&amp;referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail" style="color: #3b73af; text-decoration: none">Android</a> or <a href="https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&amp;ct=EmailNotificationLink&amp;mt=8" style="color: #3b73af; text-decoration: none">iOS</a> 
                                        <hr> </td> 
                                </tr> 
                                <tr> 
                                    <td id="footer-pattern-text" class="mobile-resize-text" width="100%" style="padding: 0; border-collapse: collapse; color: #999999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px"> This message was sent by Atlassian Jira <span id="footer-build-information">(v1001.0.0-SNAPSHOT#100077-<span title="e6cc62f521fdb687259c738f84f27fb243ae07fd" data-commit-id="e6cc62f521fdb687259c738f84f27fb243ae07fd}">sha1:e6cc62f</span>)</span> </td> 
                                    <td id="footer-pattern-logo-desktop-container" valign="top" style="padding: 0; border-collapse: collapse; padding-left: 20px; vertical-align: top"> 
                                        <table style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                                            <tbody>
                                                <tr> 
                                                    <td id="footer-pattern-logo-desktop-padding" style="padding: 0; border-collapse: collapse; padding-top: 3px; opacity: 0.150"> <img id="footer-pattern-logo-desktop" src="cid:jira-generated-image-static-footer-desktop-logo-614b99a1-7273-4f02-ad4f-08fcd713ffbb" alt="Atlassian logo" title="Atlassian logo" width="192" height="24" class="image_fix"> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
            </tbody>
        </table>   
    
<img src="https://u4043402.ct.sendgrid.net/wf/open?upn=YNXLe5Uzuivj8jGpuXra04BSJ-2BS7raa1puTAtyVUP-2F0UG25sB-2BHToWWBMcbXwnNUZIpt-2FroR7GTnMOqDVsXuEEXn9qNn3PxyrYx1Lh07c0vY8S5D6qHmQS0uHFScWao5fxPbbYchSBjYK3qNlNtK3YikzRb-2BnqFffFhr1C37mBRfPpik4CaArf1BgSBh8s07-2BOqNNa10cuDkspulS-2Fr6GkH-2FxEopAUoUVjNRKyLv9SCBSmzu9kF5MSCHmWNO6jaLoU9lbKtzgfC1K-2BARnZpXdcFsqib0FR9o6VCMISkAK4WtSwGonGo-2BfI8QOqMw7-2Fevlnci-2BA1f7xJyiEaBPSDXOWTjcmgFtgKZDIlFfRBDOeCVAh9loA5RYsQVPcJrJPDFCcldWmp-2FaeWQaab86RC9Kkkzp2Iu21ArQyD-2Fvc-2BHplbXZ3pgXDmdmX9hs558QGm-2FGCEmP6Qok5dWDXt5vZvKZg-3D-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body>
</html>