Welcome to Spring Data Hazelcast project!
The primary goal of the Spring Data project is to make it easier to build Spring-powered applications that use new data access technologies. This module provides integration with Hazelcast.
For examples on using Spring Data Hazelcast, see dedicated Code Samples: spring-data-hazelcast-chemistry-sample and spring-data-jpa-hazelcast-migration.
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>spring-data-hazelcast</artifactId>
<version>${version}</version>
</dependency>
dependencies {
compile 'com.hazelcast:spring-data-hazelcast:${version}'
}
@Configuration
@EnableHazelcastRepositories(basePackages={"example.springdata.keyvalue.chemistry"}) // <1>
public class ApplicationConfiguration {
@Bean
HazelcastInstance hazelcastInstance() { // <2>
return Hazelcast.newHazelcastInstance();
// return HazelcastClient.newHazelcastClient();
}
}
basePackages
for component scan.public interface SpeakerRepository extends HazelcastRepository<Speaker, Long> {}
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = AppConfiguration.class)
public class AppTest {
@Autowired
SpeakerRepository speakerRepository;
@Test
public void testStart(){
speakerRepository.findAll();
}
}
@Query("firstname=James")
public List<Person> peoplewiththeirFirstNameIsJames();
@Query("firstname=%s")
public List<Person> peoplewiththeirFirstName(String firstName);
@Query("firstname=%s and lastname=%s")
public List<Person> peoplewithFirstAndLastName(String firstName,String lastName);
True
False
Equal
NotEqual
Before
LessThan
LessThanEqual
After
GreaterThan
GreaterThanEqual
Between
IsNull
IsNotNull
In
NotIn
Containing
NotContaining
StartingWith
EndingWith
Like
NotLike
Regex
Distinct
IsEmpty
ExistsBy
IsWithin
IsNear
Submit your question with hazelcast
and spring-data-hazelcast
tags.
Please, join the mail group if you are interested in using or developing Hazelcast.
Hazelcast is available under the Apache 2 License. Please see the Licensing appendix for more information.
Copyright (c) 2008-2020, Hazelcast, Inc. All Rights Reserved.
Visit http://www.hazelcast.com for more information.