简体   繁体   中英

Problem with Spring and database connection

I got a problem with my connection via database and spring. I searching in all ends of internet for resolution but without success

My problem is about retrieve my list of class from database to Spring. I want to do an electronic journey app, and this is only one thing I cannot pass. So my question is -> what i need to get that connection? ( maybe some ClassDAO , ClassRepository , more)

So, my Class.java looks like this

package com.example.JournalElectronic.model;

import javax.persistence.*;
import java.util.List;

@Entity
public class Class {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String classNr;
    private int roomNr;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getClassNr() {
        return classNr;
    }

    public void setClassNr(String classNr) {
        this.classNr = classNr;
    }

    public int getRoomNr() {
        return roomNr;
    }

    public void setRoomNr(int roomNr) {
        this.roomNr = roomNr;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @ManyToOne
    @JoinColumn(name = "user_id")
    private User user;

}

and my "some" html file ->

<div class="btn-group">
<button> class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Klasy
</button>
<tr th:each var="emp" items="${classList}" varStatus="status">
    <tr>
        <td>${status.index + 1}</td>
        <td>${emp.name}</td>
    </tr>
</c:forEach>

And my second is about separate css out of .html file. My friend added all css actions into .html files, and I want to separate (for good looking code), but if i do with "ref" I cannot see colours and all of my buttons all messed up.

您是否尝试将 css 代码放在一个单独的 .css 文件中并将其链接到 HTML 像这样<link rel="stylesheet" type="text/css" href="<c:url value="/css/some.css"/>"/> ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM