// Path: src/main/java/org/nextrtc/examples/videochat_with_rest/domain/Connection.java
// @Entity
// @Table(name = "Connections")
// public class Connection {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.AUTO)
//     @JoinColumn(name = "connection_id")
//     private int id;
// 
//     @JoinColumn(name = "begin")
//     private Date begin;
// 
//     @JoinColumn(name = "closed")
//     private Date closed;
// 
//     @JoinColumn(name = "took")
//     private Long took;
// 
//     @OneToOne
//     @JoinColumn(name = "member_id")
//     private Member member;
// 
//     @ManyToOne
//     @JoinColumn(name = "conversation_id")
//     private Conversation conversation;
// 
//     @Deprecated
//     Connection() {
//     }
// 
//     Connection(Conversation conversation, Member member) {
//         this.conversation = conversation;
//         this.member = member;
//         begin = now().toDate();
//     }
// 
//     public boolean isClosed() {
//         return closed != null;
//     }
// 
//     public void close() {
//         closed = now().toDate();
//         took = new Interval(new DateTime(begin), new DateTime(closed)).toDurationMillis();
//     }
// 
//     public boolean isFor(Conversation conversation) {
//         return new EqualsBuilder()
//                 .append(this.conversation, conversation)
//                 .isEquals();
//     }
// 
//     public List<Member> getConversationMembers() {
//         return conversation.getConnections().stream().map(c -> c.member).collect(toList());
//     }
// 
//     public Date getBegin() {
//         return begin;
//     }
// 
//     public long getDuration() {
//         if (took != null) {
//             return took;
//         }
//         return new Interval(new DateTime(begin), DateTime.now()).toDurationMillis();
//     }
// }


import org.nextrtc.examples.videochat_with_rest.domain.Connection;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
package org.nextrtc.examples.videochat_with_rest.repo;


@Repository
@Transactional
// Path: src/main/java/org/nextrtc/examples/videochat_with_rest/domain/Connection.java
// @Entity
// @Table(name = "Connections")
// public class Connection {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.AUTO)
//     @JoinColumn(name = "connection_id")
//     private int id;
// 
//     @JoinColumn(name = "begin")
//     private Date begin;
// 
//     @JoinColumn(name = "closed")
//     private Date closed;
// 
//     @JoinColumn(name = "took")
//     private Long took;
// 
//     @OneToOne
//     @JoinColumn(name = "member_id")
//     private Member member;
// 
//     @ManyToOne
//     @JoinColumn(name = "conversation_id")
//     private Conversation conversation;
// 
//     @Deprecated
//     Connection() {
//     }
// 
//     Connection(Conversation conversation, Member member) {
//         this.conversation = conversation;
//         this.member = member;
//         begin = now().toDate();
//     }
// 
//     public boolean isClosed() {
//         return closed != null;
//     }
// 
//     public void close() {
//         closed = now().toDate();
//         took = new Interval(new DateTime(begin), new DateTime(closed)).toDurationMillis();
//     }
// 
//     public boolean isFor(Conversation conversation) {
//         return new EqualsBuilder()
//                 .append(this.conversation, conversation)
//                 .isEquals();
//     }
// 
//     public List<Member> getConversationMembers() {
//         return conversation.getConnections().stream().map(c -> c.member).collect(toList());
//     }
// 
//     public Date getBegin() {
//         return begin;
//     }
// 
//     public long getDuration() {
//         if (took != null) {
//             return took;
//         }
//         return new Interval(new DateTime(begin), DateTime.now()).toDurationMillis();
//     }
// }


// Path: src/main/java/org/nextrtc/examples/videochat_with_rest/repo/ConnectionRepository.java
import org.nextrtc.examples.videochat_with_rest.domain.Connection;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

package org.nextrtc.examples.videochat_with_rest.repo;


@Repository
@Transactional
public interface ConnectionRepository extends JpaRepository<Connection, Integer> {