Ich habe für Sprachen folgende Entity
mit der Spring CrudRepository
Beim Starten meine Spring Boot Anwendung wird folgende data.sql ausgeführt
Bis hierhin funktioniert auch alles. Nun wollte ich einen Test auf insert durchführen. Hierzu habe ich folgende JUnit4 / 5 Test Klasse
Beim Ausführen des Test wird mir allerdings gesagt
Nehme ich die data.sql raus, dann wird der Test korrekt, ohne Fehlermeldung, durchgeführt.
Code:
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import java.time.LocalDateTime;
@Entity
@Table(name = "languages")
public class Language {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@CreationTimestamp
private LocalDateTime created_at;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="created_by")
private User created_by;
@UpdateTimestamp
private LocalDateTime updated_at;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="updated_by")
private User updated_by;
@NotNull
String name;
@NotNull
private String iso;
public Language() {
super();
}
// Getter / Setter
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public LocalDateTime getCreatedAt() {
return created_at;
}
public void setCreatedAt(LocalDateTime created_at) {
this.created_at = created_at;
}
public User getCreatedBy() {
return created_by;
}
public void setCreatedBy(User created_by) {
this.created_by = created_by;
}
public LocalDateTime getUpdatedAt() {
return updated_at;
}
public void setUpdatedAt(LocalDateTime updated_at) {
this.updated_at = updated_at;
}
public User getUpdatedBy() {
return updated_by;
}
public void setUpdatedBy(User updated_by) {
this.updated_by = updated_by;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIso() {
return iso;
}
public void setIso(String iso) {
this.iso = iso;
}
}
mit der Spring CrudRepository
Code:
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.editor.entities.Language;
@Repository
public interface LanguageRepository extends CrudRepository<Language, Long> {
}
Beim Starten meine Spring Boot Anwendung wird folgende data.sql ausgeführt
Code:
-- Languages --
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(1, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'English', 'en');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(2, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Afar', 'aa');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(3, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Abkhazian', 'ab');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(4, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Afrikaans', 'af');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(5, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Amharic', 'am');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(6, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Arabic', 'ar');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(7, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Assamese', 'as');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(8, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Aymara', 'ay');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(9, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Azerbaijani', 'az');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(10, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Bashkir', 'ba');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(11, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Belarusian', 'be');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(12, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Bulgarian', 'bg');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(13, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Bihari', 'bh');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(14, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Bislama', 'bi');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(15, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Bengali/Bangla', 'bn');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(16, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Tibetan', 'bo');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(17, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Breton', 'br');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(18, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Catalan', 'ca');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(19, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Corsican', 'co');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(20, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Czech', 'cs');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(21, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Welsh', 'cy');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(22, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Danish', 'da');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(23, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'German', 'de');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(24, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Bhutani', 'dz');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(25, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Greek', 'el');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(26, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Esperanto', 'eo');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(27, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Spanish', 'es');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(28, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Estonian', 'et');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(29, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Basque', 'eu');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(30, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Persian', 'fa');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(31, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Finnish', 'fi');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(32, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Fiji', 'fj');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(33, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Faeroese', 'fo');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(34, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'French', 'fr');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(35, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Frisian', 'fy');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(36, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Irish', 'ga');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(37, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Scots/Gaelic', 'gd');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(38, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Galician', 'gl');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(39, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Guarani', 'gn');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(40, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Gujarati', 'gu');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(41, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Hausa', 'ha');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(42, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Hindi', 'hi');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(43, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Croatian', 'hr');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(44, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Hungarian', 'hu');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(45, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Armenian', 'hy');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(46, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Interlingua', 'ia');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(47, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Interlingue', 'ie');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(48, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Inupiak', 'ik');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(49, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Indonesian', 'in');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(50, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Icelandic', 'is');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(51, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Italian', 'it');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(52, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Hebrew', 'iw');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(53, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Japanese', 'ja');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(54, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Yiddish', 'ji');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(55, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Javanese', 'jw');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(56, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Georgian', 'ka');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(57, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Kazakh', 'kk');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(58, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Greenlandic', 'kl');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(59, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Cambodian', 'km');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(60, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Kannada', 'kn');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(61, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Korean', 'ko');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(62, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Kashmiri', 'ks');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(63, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Kurdish', 'ku');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(64, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Kirghiz', 'ky');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(65, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Latin', 'la');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(66, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Lingala', 'ln');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(67, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Laothian', 'lo');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(68, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Lithuanian', 'lt');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(69, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Latvian/Lettish', 'lv');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(70, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Malagasy', 'mg');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(71, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Maori', 'mi');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(72, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Macedonian', 'mk');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(73, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Malayalam', 'ml');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(74, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Mongolian', 'mn');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(75, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Moldavian', 'mo');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(76, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Marathi', 'mr');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(77, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Malay', 'ms');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(78, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Maltese', 'mt');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(79, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Burmese', 'my');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(80, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Nauru', 'na');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(81, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Nepali', 'ne');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(82, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Dutch', 'nl');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(83, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Norwegian', 'no');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(84, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Occitan', 'oc');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(85, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, '(Afan)/Oromoor/Oriya', 'om');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(86, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Punjabi', 'pa');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(87, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Polish', 'pl');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(88, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Pashto/Pushto', 'ps');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(89, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Portuguese', 'pt');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(90, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Quechua', 'qu');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(91, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Rhaeto-Romance', 'rm');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(92, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Kirundi', 'rn');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(93, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Romanian', 'ro');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(94, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Russian', 'ru');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(95, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Kinyarwanda', 'rw');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(96, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Sanskrit', 'sa');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(97, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Sindhi', 'sd');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(98, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Sangro', 'sg');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(99, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Serbo-Croatian', 'sh');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(100, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Singhalese', 'si');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(101, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Slovak', 'sk');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(102, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Slovenian', 'sl');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(103, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Samoan', 'sm');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(104, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Shona', 'sn');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(105, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Somali', 'so');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(106, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Albanian', 'sq');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(107, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Serbian', 'sr');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(108, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Siswati', 'ss');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(109, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Sesotho', 'st');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(110, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Sundanese', 'su');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(111, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Swedish', 'sv');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(112, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Swahili', 'sw');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(113, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Tamil', 'ta');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(114, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Telugu', 'te');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(115, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Tajik', 'tg');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(116, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Thai', 'th');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(117, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Tigrinya', 'ti');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(118, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Turkmen', 'tk');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(119, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Tagalog', 'tl');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(120, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Setswana', 'tn');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(121, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Tonga', 'to');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(122, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Turkish', 'tr');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(123, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Tsonga', 'ts');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(124, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Tatar', 'tt');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(125, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Twi', 'tw');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(126, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Ukrainian', 'uk');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(127, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Urdu', 'ur');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(128, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Uzbek', 'uz');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(129, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Vietnamese', 'vi');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(130, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Volapuk', 'vo');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(131, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Wolof', 'wo');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(132, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Xhosa', 'xh');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(133, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Yoruba', 'yo');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(134, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Chinese', 'zh');
INSERT INTO `languages` (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `name`, `iso`) VALUES(135, CURRENT_TIMESTAMP(), null, CURRENT_TIMESTAMP(), null, 'Zulu', 'zu');
Bis hierhin funktioniert auch alles. Nun wollte ich einen Test auf insert durchführen. Hierzu habe ich folgende JUnit4 / 5 Test Klasse
Code:
import static org.junit.jupiter.api.Assertions.*;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import com.editor.repositories.LanguageRepository;
import org.junit.jupiter.api.Test;
/**
* testing the language repository
*/
@SpringBootTest
class LanguageTest {
@Autowired
LanguageRepository languageRepository;
/**
* test to insert language
*/
@Test
void testInsertLanguage() {
String name = "name";
String iso = "iso";
// create language
Language language = new Language();
language.setName(name);
language.setIso(iso);
languageRepository.save(language); // HIER TRITT DER FEHLER AUF
// test
Optional<Language> foundLanguage = languageRepository.findById(language.getId());
assertTrue(foundLanguage.isPresent());
assertNotNull(foundLanguage.get().getCreatedAt());
assertNotNull(foundLanguage.get().getUpdatedAt());
assertEquals(foundLanguage.get().getName(), name);
assertEquals(foundLanguage.get().getIso(), iso);
// cleanUp
// languageRepository.deleteById(language.getId());
}
}
Beim Ausführen des Test wird mir allerdings gesagt
org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [PRIMARY]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:298)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:255)
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:538)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:744)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:712)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:631)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:385)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:178)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy111.save(Unknown Source)
at com.metho.builder.entities.LanguageTest.testInsertLanguage(LanguageTest.java:44)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:532)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:171)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:167)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:114)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:59)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:108)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:112)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:112)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:137)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:59)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:200)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3208)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3722)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:91)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)
at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:348)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:40)
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:108)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1344)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:435)
at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3221)
at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2389)
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:447)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:183)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$300(JdbcResourceLocalTransactionCoordinatorImpl.java:40)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:281)
at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:101)
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:534)
... 56 more
Caused by: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'PRIMARY'
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:117)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1092)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1040)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1347)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1025)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)
... 76 more
Nehme ich die data.sql raus, dann wird der Test korrekt, ohne Fehlermeldung, durchgeführt.