Git Product home page Git Product logo

spring-data-hazelcast's Introduction

Spring Data Hazelcast

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.

Examples

For examples on using Spring Data Hazelcast, see dedicated Code Samples: spring-data-hazelcast-chemistry-sample and spring-data-jpa-hazelcast-migration.

Artifacts

Maven

<dependency>
    <groupId>com.hazelcast</groupId>
    <artifactId>spring-data-hazelcast</artifactId>
    <version>${version}</version>
</dependency>

Gradle

dependencies {
    compile 'com.hazelcast:spring-data-hazelcast:${version}'
}

Usage

Spring Configuration

@Configuration
@EnableHazelcastRepositories(basePackages={"example.springdata.keyvalue.chemistry"}) // <1>
public class ApplicationConfiguration {
    @Bean
    HazelcastInstance hazelcastInstance() {     // <2> 
        return Hazelcast.newHazelcastInstance();
        // return HazelcastClient.newHazelcastClient();
    }
}
  1. Enables Spring Data magic for Hazelcast. You can specify basePackages for component scan.
  2. Instantiates Hazelcast instance (a member or a client)

Repository Definition

public interface SpeakerRepository extends HazelcastRepository<Speaker, Long> {}

Test of Repository

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = AppConfiguration.class)
public class AppTest {
    @Autowired
    SpeakerRepository speakerRepository;

    @Test
    public void testStart(){
        speakerRepository.findAll();
    }
}

@Query Support

Sample @Query Usages

Query with hardcoded value

@Query("firstname=James")
public List<Person> peoplewiththeirFirstNameIsJames();

Query with one variable

@Query("firstname=%s")
public List<Person> peoplewiththeirFirstName(String firstName);

Query with multiple variable values

@Query("firstname=%s and lastname=%s")
public List<Person> peoplewithFirstAndLastName(String firstName,String lastName);

Supported Query Keywords

True
False
Equal
NotEqual
Before
LessThan
LessThanEqual
After
GreaterThan
GreaterThanEqual
Between
IsNull
IsNotNull
In
NotIn
Containing
NotContaining
StartingWith
EndingWith
Like
NotLike
Regex

Community

Chat with developers

Gitter

Stack Overflow

Stack Overflow

Submit your question with hazelcast and spring-data-hazelcast tags.

Mail Group

Please, join the mail group if you are interested in using or developing Hazelcast.

License

Hazelcast is available under the Apache 2 License. Please see the Licensing appendix for more information.

Copyright

Copyright (c) 2008-2020, Hazelcast, Inc. All Rights Reserved.

Visit http://www.hazelcast.com for more information.

spring-data-hazelcast's People

Contributors

bilalyasar avatar christophstrobl avatar dependabot-preview[bot] avatar devopshazelcast avatar dineshbhagat avatar elsega avatar em-chips avatar eugenenik avatar gamussa avatar gokhanoner avatar googlielmo avatar hasancelik avatar ilkerkorkut avatar kenkc avatar neilstevenson avatar noctarius avatar odrotbohm avatar pivovarit avatar suhotskiy avatar ulhasrm avatar viacheslav-petriaiev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.