



import-cypher -d , -i ./import/nodes.csv -o ./import/nodes_output.txt create(p#{node}:Person {id:{node}, name:{name}, gender:{gender}})
import-cypher -d , -i ./import/relationships.csv -o ./import/relationships_output.txt match (from:Person), (to:Person) where from.id={From} and to.id={To} create (from)-[:#{Relation Type}]->(to)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | package com.xxx.entity; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.MappedSuperclass; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.hibernate.annotations.GenerationTime; import org.hibernate.annotations.GeneratorType; import org.springframework.data.annotation.LastModifiedDate; import com.xxx.LoggedUserGenerator; import lombok.Data; @Data @MappedSuperclass public abstract class AbstractCommonEntity implements Serializable { private static final long serialVersionUID = 1L; @GeneratorType(type = LoggedUserGenerator.class, when = GenerationTime.ALWAYS) @Column(name = "LAST_MODIFIED_BY") private String lastModifiedBy; @LastModifiedDate @Column(name = "LAST_MODIFIED_DATETIME") private Date lastModifiedDatetime; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | package com.xxx.entity; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import lombok.Data; import lombok.EqualsAndHashCode; @Entity @Table(name = "ACTION") @Data @EntityListeners(AuditingEntityListener.class) @EqualsAndHashCode(of = "id", callSuper = false) public class Action extends AbstractCommonEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @SequenceGenerator(name = "ACTION_ID_SEQ", sequenceName = "ACTION_ID_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ACTION_ID_SEQ") @Column(name = "ID") private Integer id; @Column(name = "NAME") private String name; @Column(name = "DEPEND_SLOTS") private String dependSlots; @Column(name = "PROJECT_ID") private Integer projectId; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | package com.xxx.entity; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.MappedSuperclass; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.hibernate.annotations.GenerationTime; import org.hibernate.annotations.GeneratorType; import org.springframework.data.annotation.LastModifiedDate; import com.xxx.LoggedUserGenerator; import lombok.Data; @Data @MappedSuperclass @JsonIgnoreProperties({ "lastModifiedBy", "lastModifiedDatetime" }) public abstract class AbstractCommonEntity implements Serializable { private static final long serialVersionUID = 1L; @GeneratorType(type = LoggedUserGenerator.class, when = GenerationTime.ALWAYS) @Column(name = "LAST_MODIFIED_BY") private String lastModifiedBy; @LastModifiedDate @Column(name = "LAST_MODIFIED_DATETIME") private Date lastModifiedDatetime; } |
select id, domain_projects from project where domain_classifier = true
select id, domain_projects from project where domain_classifier = true and '26' = any(string_to_array(domain_projects, ','))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | package test.entity; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.MappedSuperclass; import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedDate; import lombok.Data; @Data @MappedSuperclass public abstract class CommonEntity implements Serializable { private static final long serialVersionUID = 1L; @LastModifiedBy @Column(name = "LAST_MODIFIED_BY") private String lastModifiedBy; @LastModifiedDate @Column(name = "LAST_MODIFIED_DATETIME") private Date lastModifiedDatetime; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | package test.entity; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import lombok.Data; import lombok.EqualsAndHashCode; @Entity @Table(name = "PROJECT") @Data @EqualsAndHashCode(of = "id", callSuper = false) public class Project extends CommonEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @SequenceGenerator(name = "PROJECT_ID_SEQ", sequenceName = "PROJECT_ID_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PROJECT_ID_SEQ") @Column(name = "ID") private Integer id; @Column(name = "IDENTIFIER") private String identifier; @Column(name = "NAME") private String name; @Column(name = "STATUS") private String status; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | package test.entity; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.Id; import javax.persistence.Lob; import javax.persistence.Table; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import lombok.Data; import lombok.EqualsAndHashCode; @Entity @Table(name = "MODEL") @Data @EqualsAndHashCode(of = "id", callSuper = false) public class Model extends CommonEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "ID") private String id; @Column(name = "PROJECT_ID") private Integer projectId; @Lob @Column(name = "STATISTICS_JSON") private String statisticsJson; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | package com.cht.ai.bot.entity; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import lombok.Data; import lombok.EqualsAndHashCode; @Entity @Table(name = "SLOT") @Data @EqualsAndHashCode(of = "id", callSuper = false) public class Slot extends CommonEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @SequenceGenerator(name = "SLOT_ID_SEQ", sequenceName = "SLOT_ID_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SLOT_ID_SEQ") @Column(name = "ID") private Integer id; @Column(name = "NAME") private String name; @Column(name = "TYPE") private String type; } |
SQLState: 42883, No operator matches the given name and argument type(s). You might need to add explicit type casts.
select * from project where id in (select unnest(string_to_array( (select domain_projects from project where id = :projectId), ',')))
select * from project where id in (select cast(unnest(string_to_array( (select domain_projects from project where id = :projectId), ',')) as int))
select cast(unnest(string_to_array( (select domain_projects from project where id = :id), ',')) as int) as project_id
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | package test.albert.sorting; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; @Slf4j public class SortingExample { public static void main(String[] args) { SortingExample sortingExample = new SortingExample(); List<Song> songs = sortingExample.createSongs(); sortingExample.sortedByYear(songs); sortingExample.sortedByArtistAlbum(songs); sortingExample.sortedByYearArtistAlbum(songs); } private List<Song> sortedByYear(List<Song> songs) { List<Song> sortedSongs = new ArrayList<Song>(); sortedSongs = songs.stream().sorted(Comparator.comparingInt(Song::getReleaseYear)).collect(Collectors.toList()); log.debug("sorted by rlease year"); sortedSongs.forEach(s -> log.debug(s.toString())); log.debug("\n"); return sortedSongs; } private List<Song> sortedByArtistAlbum(List<Song> songs) { List<Song> sortedSongs = new ArrayList<Song>(); sortedSongs = songs.stream().sorted(Comparator.comparing(Song::getArtist).thenComparing(Song::getAlbum)) .collect(Collectors.toList()); log.debug("sorted by artist, album"); sortedSongs.forEach(s -> log.debug(s.toString())); log.debug("\n"); return sortedSongs; } private List<Song> sortedByYearArtistAlbum(List<Song> songs) { List<Song> sortedSongs = new ArrayList<Song>(); sortedSongs = songs.stream().sorted(Comparator.comparingInt(Song::getReleaseYear).thenComparing(Song::getArtist) .thenComparing(Song::getAlbum)).collect(Collectors.toList()); log.debug("sorted by rlease year, artist, album"); sortedSongs.forEach(s -> log.debug(s.toString())); log.debug("\n"); return sortedSongs; } private List<Song> createSongs() { Song jay = new Song("告白氣球", "周杰倫的床邊故事", "周杰倫", 2016); Song mayday = new Song("任意門", "自傳", "五月天", 2016); Song jamHsiao = new Song("阿飛的小蝴蝶", "王妃", "蕭敬騰", 2009); Song hebe = new Song("不醉不會", "渺小", "田馥甄", 2013); Song lala = new Song("尋人啟事", "尋人啟事", "徐佳瑩", 2015); return Arrays.asList(jay, mayday, jamHsiao, hebe, lala); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | sorted by rlease year Song(title=阿飛的小蝴蝶, album=王妃, artist=蕭敬騰, releaseYear=2009) Song(title=不醉不會, album=渺小, artist=田馥甄, releaseYear=2013) Song(title=尋人啟事, album=尋人啟事, artist=徐佳瑩, releaseYear=2015) Song(title=告白氣球, album=周杰倫的床邊故事, artist=周杰倫, releaseYear=2016) Song(title=任意門, album=自傳, artist=五月天, releaseYear=2016) sorted by artist, album Song(title=任意門, album=自傳, artist=五月天, releaseYear=2016) Song(title=告白氣球, album=周杰倫的床邊故事, artist=周杰倫, releaseYear=2016) Song(title=尋人啟事, album=尋人啟事, artist=徐佳瑩, releaseYear=2015) Song(title=不醉不會, album=渺小, artist=田馥甄, releaseYear=2013) Song(title=阿飛的小蝴蝶, album=王妃, artist=蕭敬騰, releaseYear=2009) sorted by rlease year, artist, album Song(title=阿飛的小蝴蝶, album=王妃, artist=蕭敬騰, releaseYear=2009) Song(title=不醉不會, album=渺小, artist=田馥甄, releaseYear=2013) Song(title=尋人啟事, album=尋人啟事, artist=徐佳瑩, releaseYear=2015) Song(title=任意門, album=自傳, artist=五月天, releaseYear=2016) Song(title=告白氣球, album=周杰倫的床邊故事, artist=周杰倫, releaseYear=2016) |