从Jboss4.2迁移到Jboss7.2后出现Hibernate HQL问题

时间:2016-12-26 14:45:59

标签: java spring hibernate jboss7.x jboss-4.2.x

最近我们已经从Jboss4.2迁移到Jboss 7.2。完全相同的HQL查询对Jboss4.2运行正常。但是在Jboss7.2中,HQL查询在Jboss7.2中运行不正常,它给出了我在下面提到的错误:

<html lang="en">
<head>
    <meta charset="utf-8">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<body>
<?php
// Initialize table markup buffer
$table_markup = "<table border='1'>";

// Itinerate rows
for ($i = 1; $i <= 7; $i++) {
    $table_markup .= "<tr>";

    // Itinerate columns
    for ($j = 1; $j <= 6; $j++) {

        // Define Cell ID
        $td_id = "cell-".$j.$i;

        // Create Cell content
        if($i == 1 && $j <> 1){ // Radios for first row, ignore first cell
            $radio_value = "radio-top-".$j;
            $td_content = "<input type='radio' name='top' value='".$radio_value."'/>";
            $td_class = "";
        }else if($j == 1 && $i <> 1) { // Radios for first column, ignore first cell
            $radio_value = "radio-right-".$i;
            $td_content = "<input type='radio' name='right' value='".$radio_value."'/>";
            $td_class = "";
        }else{
            $td_content = "";
            $td_class = "noradio";
        }

        // Put Cell on table row
        $table_markup .= "<td id='".$td_id."' class='".$td_class."' width='30'height='30'>".$td_content."</td>";
    }
    $table_markup .= "</tr>";
}

// Finalize table markup buffer
$table_markup .= "</table>";
?>

<?php echo $table_markup; // Use this anywhere you want to show your table ?>

<script type="text/javascript">
    // This is the jquery code that does your dynamic manipulations

    // When click on any radio button
    $("input[type=radio]").click(function(){
        // Obtain the value of the checkeds top and right radios
        var top_val = $("input[name=top]:checked").val();
        var right_val = $("input[name=right]:checked").val();

        // If both are checked
        if(top_val && right_val){
            // Get their number
            var top_number = top_val.replace("radio-top-", "");
            var right_number = right_val.replace("radio-right-", "");

            // Mount cell id for search
            var cell_id = "cell-"+top_number+right_number;

            // Clean all cells that dont have radios
            $("td.noradio").html("");

            // Mark found cell
            $("td#"+cell_id).html("*");
        }
    });
</script>

</body>
</html>

我们已升级:

  • Java从jdk1.5到jdk1.7,
  • Hibernate 3到Hibernate 4,
  • JPA 1我们已用于两个版本
  • EJB 3我们已用于两个版本

2 个答案:

答案 0 :(得分:0)

检查你的HQL查询语法是否mudid确实是一个数据库列名/ hibernate实体属性名是否可用?

答案 1 :(得分:0)

OneToMany关系的示例和反向ManyToOne注释

@Entity
public class ProjectForm ....
...
@Id
@Column(name="PF_ID")
private long projectFormId;
...
@OneToMany(mappedBy="projectForm", cascade = { CascadeType.ALL})
private Set<Contact> contacts = new HashSet<Contact>();
...


@Entity
public class Contact ...
...
@ManyToOne(cascade= {CascadeType.ALL} , fetch=FetchType.LAZY)
@JoinColumn(name="PROJECTFORM_CONTACT")
private ProjectForm projectForm;
...