Skip to content

Commit

Permalink
KNL-945 Hibernate upgrade from 3.6 to 4.3 (sakaiproject#3719)
Browse files Browse the repository at this point in the history
  • Loading branch information
ern authored Feb 14, 2017
1 parent 790ad41 commit 7b58978
Show file tree
Hide file tree
Showing 493 changed files with 14,405 additions and 20,873 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false">
<class name="org.sakaiproject.assignment.api.model.AssignmentAllPurposeItemAccess" table="ASN_AP_ITEM_ACCESS_T">
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.sakaiproject.assignment.api.model"
default-lazy="false">

<class name="org.sakaiproject.assignment.api.model.AssignmentAllPurposeItemAccess" table="ASN_AP_ITEM_ACCESS_T">

<id name="id" column="ID" type="long">
<generator class="native">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="org.sakaiproject.assignment.api.model" default-lazy="false">
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.sakaiproject.assignment.api.model"
default-lazy="false">

<class name="AssignmentSupplementItemWithAttachment" table="ASN_SUP_ITEM_T" >

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping default-lazy="false">
<class name="org.sakaiproject.assignment.api.model.AssignmentSupplementItemAttachment" table="ASN_SUP_ATTACH_T">
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.sakaiproject.assignment.api.model"
default-lazy="false">

<class name="org.sakaiproject.assignment.api.model.AssignmentSupplementItemAttachment" table="ASN_SUP_ATTACH_T">

<comment>This table is for assignment supplement item attachment. </comment>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.sakaiproject.assignment.api.model"
default-lazy="false">

<hibernate-mapping default-lazy="false">
<class name="org.sakaiproject.assignment.api.model.PeerAssessmentAttachment" table="ASN_PEER_ASSESSMENT_ATTACH_T">

<id name="id" column="ID" type="long">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping default-lazy="false">
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.sakaiproject.assignment.api.model"
default-lazy="false">

<class name="org.sakaiproject.assignment.api.model.PeerAssessmentItem" table="ASN_PEER_ASSESSMENT_ITEM_T">
<composite-id>
<key-property name="submissionId">
Expand Down
5 changes: 4 additions & 1 deletion assignment/assignment-impl/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<!-- required for the schema conversion utility -->
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import org.sakaiproject.time.api.TimeService;
import org.sakaiproject.tool.api.SessionManager;
import org.sakaiproject.user.api.User;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.orm.hibernate4.HibernateCallback;
import org.springframework.orm.hibernate4.support.HibernateDaoSupport;

public class AssignmentPeerAssessmentServiceImpl extends HibernateDaoSupport implements AssignmentPeerAssessmentService {
private static Logger log = LoggerFactory.getLogger(AssignmentPeerAssessmentServiceImpl.class);
Expand Down Expand Up @@ -266,18 +266,13 @@ public List<PeerAssessmentItem> getPeerAssessmentItems(final Collection<String>
//return an empty list
return listPeerAssessmentItem;
}
HibernateCallback hcb = new HibernateCallback()
{
public Object doInHibernate(Session session) throws HibernateException,
SQLException
{
Query q = session.getNamedQuery("findPeerAssessmentItemsBySubmissions");
q.setParameterList("submissionIds", submissionsIds);
return q.list();
}
};
HibernateCallback<List<PeerAssessmentItem>> hcb = session -> {
Query q = session.getNamedQuery("findPeerAssessmentItemsBySubmissions");
q.setParameterList("submissionIds", submissionsIds);
return q.list();
};

listPeerAssessmentItem = (List<PeerAssessmentItem>) getHibernateTemplate().execute(hcb);
listPeerAssessmentItem = getHibernateTemplate().execute(hcb);

for (PeerAssessmentItem item : listPeerAssessmentItem) {
item.setScaledFactor(scaledFactor);
Expand All @@ -292,19 +287,14 @@ public List<PeerAssessmentItem> getPeerAssessmentItems(final String assignmentId
//return an empty list
return listPeerAssessmentItem;
}
HibernateCallback hcb = new HibernateCallback()
{
public Object doInHibernate(Session session) throws HibernateException,
SQLException
{
Query q = session.getNamedQuery("findPeerAssessmentItemsByUserAndAssignment");
q.setParameter("assignmentId", assignmentId);
q.setParameter("assessorUserId", assessorUserId);
return q.list();
}
};
HibernateCallback<List<PeerAssessmentItem>> hcb = session -> {
Query q = session.getNamedQuery("findPeerAssessmentItemsByUserAndAssignment");
q.setParameter("assignmentId", assignmentId);
q.setParameter("assessorUserId", assessorUserId);
return q.list();
};

listPeerAssessmentItem = (List<PeerAssessmentItem>) getHibernateTemplate().execute(hcb);
listPeerAssessmentItem = getHibernateTemplate().execute(hcb);

for (PeerAssessmentItem item : listPeerAssessmentItem) {
item.setScaledFactor(scaledFactor);
Expand All @@ -319,18 +309,13 @@ public List<PeerAssessmentItem> getPeerAssessmentItems(final String submissionId
//return an empty list
return listPeerAssessmentItem;
}
HibernateCallback hcb = new HibernateCallback()
{
public Object doInHibernate(Session session) throws HibernateException,
SQLException
{
Query q = session.getNamedQuery("findPeerAssessmentItemsBySubmissionId");
q.setParameter("submissionId", submissionId);
return q.list();
}
};
HibernateCallback<List<PeerAssessmentItem>> hcb = session -> {
Query q = session.getNamedQuery("findPeerAssessmentItemsBySubmissionId");
q.setParameter("submissionId", submissionId);
return q.list();
};

listPeerAssessmentItem = (List<PeerAssessmentItem>) getHibernateTemplate().execute(hcb);
listPeerAssessmentItem = getHibernateTemplate().execute(hcb);

for (PeerAssessmentItem item : listPeerAssessmentItem) {
item.setScaledFactor(scaledFactor);
Expand All @@ -345,18 +330,13 @@ public List<PeerAssessmentItem> getPeerAssessmentItemsByAssignmentId(final Strin
//return an empty list
return listPeerAssessmentItem;
}
HibernateCallback hcb = new HibernateCallback()
{
public Object doInHibernate(Session session) throws HibernateException,
SQLException
{
Query q = session.getNamedQuery("findPeerAssessmentItemsByAssignmentId");
q.setParameter("assignmentId", assignmentId);
return q.list();
}
};
HibernateCallback<List<PeerAssessmentItem>> hcb = session -> {
Query q = session.getNamedQuery("findPeerAssessmentItemsByAssignmentId");
q.setParameter("assignmentId", assignmentId);
return q.list();
};

listPeerAssessmentItem = (List<PeerAssessmentItem>) getHibernateTemplate().execute(hcb);
listPeerAssessmentItem = getHibernateTemplate().execute(hcb);

for (PeerAssessmentItem item : listPeerAssessmentItem) {
item.setScaledFactor(scaledFactor);
Expand All @@ -370,19 +350,14 @@ public PeerAssessmentItem getPeerAssessmentItem(final String submissionId, final
//return an empty list
return null;
}
HibernateCallback hcb = new HibernateCallback()
{
public Object doInHibernate(Session session) throws HibernateException,
SQLException
{
Query q = session.getNamedQuery("findPeerAssessmentItemsByUserAndSubmission");
q.setParameter("submissionId", submissionId);
q.setParameter("assessorUserId", assessorUserId);
return q.list();
}
};
HibernateCallback<List<PeerAssessmentItem>> hcb = session -> {
Query q = session.getNamedQuery("findPeerAssessmentItemsByUserAndSubmission");
q.setParameter("submissionId", submissionId);
q.setParameter("assessorUserId", assessorUserId);
return q.list();
};

List<PeerAssessmentItem> results = (List<PeerAssessmentItem>) getHibernateTemplate().execute(hcb);
List<PeerAssessmentItem> results = getHibernateTemplate().execute(hcb);
if(results != null && results.size() == 1){
return results.get(0);
}else{
Expand All @@ -393,16 +368,16 @@ public Object doInHibernate(Session session) throws HibernateException,
public List<PeerAssessmentAttachment> getPeerAssessmentAttachments(final String submissionId, final String assessorUserId){
if(submissionId == null || "".equals(submissionId) || assessorUserId == null || "".equals(assessorUserId)){
//return an empty list
return new ArrayList<PeerAssessmentAttachment>();
return new ArrayList<>();
}
HibernateCallback hcb = session -> {
HibernateCallback<List<PeerAssessmentAttachment>> hcb = session -> {
Query q = session.getNamedQuery("findPeerAssessmentAttachmentsByUserAndSubmission");
q.setParameter("submissionId", submissionId);
q.setParameter("assessorUserId", assessorUserId);
return q.list();
};

return (List<PeerAssessmentAttachment>) getHibernateTemplate().execute(hcb);
return getHibernateTemplate().execute(hcb);
}

public PeerAssessmentAttachment getPeerAssessmentAttachment(final String submissionId, final String assessorUserId, final String resourceId) {
Expand Down
Loading

0 comments on commit 7b58978

Please sign in to comment.