Skip to content

Commit 5a7b4e7

Browse files
workin on #161
1 parent ac5493c commit 5a7b4e7

25 files changed

+41
-88
lines changed

src/main/java/org/woehlke/twitterwall/oodm/entities/Tweet.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
import java.util.HashMap;
1616
import java.util.Map;
1717

18-
import static javax.persistence.CascadeType.DETACH;
19-
import static javax.persistence.CascadeType.REFRESH;
20-
import static javax.persistence.CascadeType.REMOVE;
18+
import static javax.persistence.CascadeType.*;
2119
import static javax.persistence.FetchType.EAGER;
2220

2321
/**
@@ -137,7 +135,7 @@ public class Tweet extends AbstractDomainObject<Tweet> implements DomainObjectWi
137135
private Boolean retweeted;
138136

139137
@JoinColumn(name="fk_tweet_retweeted")
140-
@ManyToOne(cascade = {DETACH, REFRESH, REMOVE}, fetch = EAGER, optional = true)
138+
@ManyToOne(cascade = {ALL}, fetch = EAGER, optional = true)
141139
private Tweet retweetedStatus;
142140

143141
@Column(name="favorited")
@@ -186,7 +184,7 @@ public class Tweet extends AbstractDomainObject<Tweet> implements DomainObjectWi
186184
@Valid
187185
@NotNull
188186
@JoinColumn(name="fk_user")
189-
@ManyToOne(cascade = {DETACH, REFRESH, REMOVE}, fetch = EAGER, optional = false)
187+
@ManyToOne(cascade = { ALL }, fetch = EAGER, optional = false)
190188
private User user;
191189

192190
@AssertTrue

src/main/java/org/woehlke/twitterwall/oodm/entities/parts/Entities.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
import java.util.List;
1313
import java.util.Set;
1414

15-
import static javax.persistence.CascadeType.DETACH;
16-
import static javax.persistence.CascadeType.REFRESH;
17-
import static javax.persistence.CascadeType.REMOVE;
15+
import static javax.persistence.CascadeType.*;
1816
import static javax.persistence.FetchType.EAGER;
1917

2018
/**
@@ -25,23 +23,24 @@
2523
public class Entities extends EntitiesFilter implements DomainObjectEmbededField {
2624

2725
@NotNull
28-
@ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER)
26+
//@ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER)
27+
@ManyToMany(cascade = { ALL }, fetch = EAGER)
2928
private Set<Url> urls = new LinkedHashSet<Url>();
3029

3130
@NotNull
32-
@ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER)
31+
@ManyToMany(cascade = { ALL }, fetch = EAGER)
3332
private Set<HashTag> hashTags = new LinkedHashSet<HashTag>();
3433

3534
@NotNull
36-
@ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER)
35+
@ManyToMany(cascade = { ALL }, fetch = EAGER)
3736
private Set<Mention> mentions = new LinkedHashSet<Mention>();
3837

3938
@NotNull
40-
@ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER)
39+
@ManyToMany(cascade = { ALL }, fetch = EAGER)
4140
private Set<Media> media = new LinkedHashSet<Media>();
4241

4342
@NotNull
44-
@ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER)
43+
@ManyToMany(cascade = { ALL }, fetch = EAGER)
4544
private Set<TickerSymbol> tickerSymbols = new LinkedHashSet<TickerSymbol>();
4645

4746
public Entities(Set<Url> urls, Set<HashTag> hashTags, Set<Mention> mentions, Set<Media> media, Set<TickerSymbol> tickerSymbols) {

src/main/java/org/woehlke/twitterwall/oodm/service/impl/DomainServiceWithTaskImpl.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@
44
import org.slf4j.LoggerFactory;
55
import org.springframework.data.domain.Page;
66
import org.springframework.data.domain.Pageable;
7-
import org.springframework.transaction.annotation.Propagation;
8-
import org.springframework.transaction.annotation.Transactional;
97
import org.woehlke.twitterwall.oodm.entities.Task;
108
import org.woehlke.twitterwall.oodm.entities.common.DomainObjectWithTask;
119
import org.woehlke.twitterwall.oodm.repositories.TaskRepository;
1210
import org.woehlke.twitterwall.oodm.repositories.common.DomainRepository;
1311
import org.woehlke.twitterwall.oodm.service.common.DomainService;
1412

1513

16-
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
1714
public abstract class DomainServiceWithTaskImpl<T extends DomainObjectWithTask> implements DomainService<T> {
1815

1916
private static final Logger log = LoggerFactory.getLogger(DomainServiceWithTaskImpl.class);
@@ -43,7 +40,6 @@ public long count() {
4340
}
4441

4542
@Override
46-
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
4743
public T store(T domainObject, Task task) {
4844
String msg = "store "+domainObject.getUniqueId()+" in Task "+task.getUniqueId()+" ";
4945
T domainObjectResult = null;

src/main/java/org/woehlke/twitterwall/oodm/service/impl/HashTagServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Created by tw on 12.06.17.
1616
*/
1717
@Service
18-
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
18+
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
1919
public class HashTagServiceImpl extends DomainServiceWithTaskImpl<HashTag> implements HashTagService {
2020

2121
private static final Logger log = LoggerFactory.getLogger(HashTagServiceImpl.class);

src/main/java/org/woehlke/twitterwall/oodm/service/impl/MediaServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Created by tw on 12.06.17.
1616
*/
1717
@Service
18-
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
18+
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
1919
public class MediaServiceImpl extends DomainServiceWithTaskImpl<Media> implements MediaService {
2020

2121
private static final Logger log = LoggerFactory.getLogger(MediaServiceImpl.class);

src/main/java/org/woehlke/twitterwall/oodm/service/impl/MentionServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Created by tw on 12.06.17.
2222
*/
2323
@Service
24-
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
24+
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
2525
public class MentionServiceImpl extends DomainServiceWithTaskImpl<Mention> implements MentionService {
2626

2727
private static final Logger log = LoggerFactory.getLogger(MentionServiceImpl.class);

src/main/java/org/woehlke/twitterwall/oodm/service/impl/TaskHistoryServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* Created by tw on 11.07.17.
1818
*/
1919
@Service
20-
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
20+
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
2121
public class TaskHistoryServiceImpl implements TaskHistoryService {
2222

2323
private static final Logger log = LoggerFactory.getLogger(TaskHistoryServiceImpl.class);

src/main/java/org/woehlke/twitterwall/oodm/service/impl/TaskServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Created by tw on 09.07.17.
2424
*/
2525
@Service
26-
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
26+
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
2727
public class TaskServiceImpl implements TaskService {
2828

2929
private static final Logger log = LoggerFactory.getLogger(TaskServiceImpl.class);

src/main/java/org/woehlke/twitterwall/oodm/service/impl/TickerSymbolServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Created by tw on 12.06.17.
1717
*/
1818
@Service
19-
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
19+
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
2020
public class TickerSymbolServiceImpl extends DomainServiceWithTaskImpl<TickerSymbol> implements TickerSymbolService {
2121

2222
private static final Logger log = LoggerFactory.getLogger(TickerSymbolServiceImpl.class);

src/main/java/org/woehlke/twitterwall/oodm/service/impl/TweetServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Created by tw on 10.06.17.
2222
*/
2323
@Service
24-
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
24+
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
2525
public class TweetServiceImpl extends DomainServiceWithTaskImpl<Tweet> implements TweetService {
2626

2727
private static final Logger log = LoggerFactory.getLogger(TweetServiceImpl.class);

0 commit comments

Comments
 (0)