This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from sqlalchemy.sql import and_, or_, not_ | |
>>> print(and_( | |
... users.c.name.like('j%'), | |
... users.c.id == addresses.c.user_id, | |
... or_( | |
... addresses.c.email_address == '[email protected]', | |
... addresses.c.email_address == '[email protected]' | |
... ), | |
... not_(users.c.id > 5) | |
... ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ... */ | |
public class BookRepositoryImpl implements BookRepositoryCustom { | |
private final MongoTemplate mongoTemplate; | |
@Autowired | |
public BookRepositoryImpl(MongoTemplate mongoTemplate) { | |
this.mongoTemplate = mongoTemplate; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ... */ | |
2public class BookRepositoryImpl implements BookRepositoryCustom { | |
3 | |
4 private final MongoTemplate mongoTemplate; | |
5 | |
6 @Autowired | |
7 public BookRepositoryImpl(MongoTemplate mongoTemplate) { | |
8 this.mongoTemplate = mongoTemplate; | |
9 } | |
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ... */ | |
2public class BookRepositoryImpl implements BookRepositoryCustom { | |
3 | |
4 private final MongoTemplate mongoTemplate; | |
5 | |
6 @Autowired | |
7 public BookRepositoryImpl(MongoTemplate mongoTemplate) { | |
8 this.mongoTemplate = mongoTemplate; | |
9 } | |
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mkyong.domain; | |
import com.mongodb.WriteResult; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.data.mongodb.core.MongoTemplate; | |
import org.springframework.data.mongodb.core.query.Criteria; | |
import org.springframework.data.mongodb.core.query.Query; | |
import org.springframework.data.mongodb.core.query.Update; | |
//Impl postfix of the name on it compared to the core repository interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mkyong.domain; | |
public interface DomainRepositoryCustomAnyName { | |
int updateDomainDisplayFlagOnly(String domain, boolean flag); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mkyong.domain; | |
import org.springframework.data.mongodb.repository.MongoRepository; | |
import org.springframework.data.mongodb.repository.Query; | |
import java.util.List; | |
public interface DomainRepository extends MongoRepository<Domain, Long> { | |
Domain findByDomainAndIP(String domain, String ip); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mkyong.dao; | |
import com.mkyong.model.Customer; | |
import org.springframework.data.jpa.repository.Query; | |
import org.springframework.data.repository.CrudRepository; | |
import org.springframework.data.repository.query.Param; | |
import java.util.Date; | |
import java.util.List; | |
import java.util.stream.Stream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mkyong.dao; | |
import com.mkyong.model.Customer; | |
import java.util.List; | |
public class CustomerRepositoryImpl implements CustomerRepositoryCustomAbc { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mkyong.dao; | |
import com.mkyong.model.Customer; | |
import java.util.List; | |
public interface CustomerRepositoryCustomAbc { | |
List<Customer> findByAVeryComplicatedQuery(Long id, String name, String address); |