메이븐 프로젝트 테스트 스킵 JAVA SE

goal 을 아래처럼 옵션을 준다

package -Dmaven.test.skip=true





Jackson @JsonFormat Example JAVA SE

https://www.concretepage.com/jackson-api/jackson-jsonformat-example

JsonFormat.Shape.STRING

When we assign JsonFormat.Shape.STRING to shape attribute in @JsonFormat for a property, suppose Date type, then in serialization JSON will be string type in given pattern for that property.
public class Writer {   @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MMM-dd HH:mm:ss z")   @JsonProperty("pubDate")   private Date recentBookPubDate;} 
Output will be as following.
{  "pubDate" : "2018-Jun-11 07:41:23 UTC"} 

JsonFormat.Shape.NUMBER

When we assign JsonFormat.Shape.NUMBER to shape attribute in @JsonFormat for a property, suppose Date type, then in serialization JSON will be number type for that property.
public class Writer {   @JsonFormat(shape=JsonFormat.Shape.NUMBER)   @JsonProperty("bdate")   private Date birthDate;} 
Output will be as following.
{  "bdate" : 1528702883858} 

@JsonFormat with Enum

@JsonFormat can be used with Java enum in serialization to change between index (number) and textual name (string). @JsonFormat is used at enum level and not at property level. By default enum properties are serialized with its textual name as string. We can change it to property index (starting from 0) using JsonFormat.Shape.NUMBER. Find the sample example.
package com.concretepage;import com.fasterxml.jackson.annotation.JsonFormat;@JsonFormat(shape=JsonFormat.Shape.NUMBER)enum Code {    BLOCKING,    CRITICAL,    MEDIUM,    LOW;} 

MyBatis 3 Annotation Example with @Select, @Insert, @Update and @Delete JAVA EE

https://www.concretepage.com/mybatis-3/mybatis-3-annotation-example-with-select-insert-update-and-delete

@Select : We need to provide select query as value. 
@Results : Maps column name and POJO property to get result in select query. 
@Insert : We need to provide insert query as a value. 
@Update : We need to provide update query as a value. 
@Delete : We need to provide delete query as a value. 

Find the Mapper interface. 
VillageMapper.java
package com.concretepage;import org.apache.ibatis.annotations.Delete;import org.apache.ibatis.annotations.Insert;import org.apache.ibatis.annotations.Result;import org.apache.ibatis.annotations.Results;import org.apache.ibatis.annotations.Select;import org.apache.ibatis.annotations.Update;public interface VillageMapper {	@Results({          @Result(property = "vid", column = "id"),          @Result(property = "villageName", column = "name"),          @Result(property = "district", column = "district")        })	@Select("SELECT id, name, district from village WHERE id = #{id}")	Village selectVillage(int id);		@Insert("INSERT into village(name,district) VALUES(#{villageName}, #{district})")	void insertVillage(Village village);		@Update("UPDATE village SET name=#{villageName}, district =#{district} WHERE id =#{vid}")	void updateVillage(Village village);		@Delete("DELETE FROM village WHERE id =#{id}")	void deleteVillage(int id);} 

Apache Ignite With Spring Data NoSQL/Big Data/DB


If you want to learn more about Apache Ignite (using JPA, Hibernate or MyBatis), check out my book.

Spring Data provides a unified and easy way to access the different kinds of persistence stores: both relational database systems and NoSQL data stores. It is on top of JPA, adding another layer of abstraction and defining a standard-based design to support persistence layers in a Spring context.

Image title

Apache Ignite IgniteRepository implements the Spring Data CrudRepository interface and extends the basic capabilities of the CrudRepository, which in turns supports:

  • Basic CRUD operations on a repository for a specific type.

  • Access to the Apache Ignite SQL grid via Spring Data API.

Sprig Data and Ignite

With Spring Data's repositories, you only need to write an interface with finder methods to query the objects. All the CRUD methods for manipulating the objects will be delivered automatically. As an example:

@RepositoryConfig(cacheName = "DogCache")
public interface DogRepository extends IgniteRepository < Dog, Long > {
 List < Dog > getDogByName(String name);
 Dog getDogById(Long id);
}

In this article, we are going to cover the following topics:

  • Create a Maven project from scratch for using Spring Data with Apache Ignite Grid.

  • Persist a few entities into Ignite caches through Spring Data framework.

Before we start, let's cover the prerequisites of the project in your sandbox:

  1. Java JDK 1.8

  2. Ignite version 2.0.

  3. Apache Maven version >3.0.3.

The Apache Ignite book

An updated version of using Spring data with Ignite described in the book The Apache Ignite book. If it got you interested, check out the rest of the book for more helpful information. There is a special 20% discount for the DZone readers, please use the following coupon.



What Is Apache Ignite? NoSQL/Big Data/DB



If you ever looked at Apache® Ignitetm, you have probably noticed that it is a fairly rich platform with lots of components. However, despite the extensive feature set, Ignite community aims to make the platform easy to use and understand. Here is how the Ignite community defines their project:

Apache Ignite is an in-memory computing platform that is durable, strongly consistent, and highly available with powerful SQL, key-value, and processing APIs.

So, in summary, Ignite looks like a distributed data storage that can work both in-memory and on-disk, and provides SQL, key-value, and processing APIs to the data. Sounds simple enough. However, to get a complete picture, perhaps it is better to define Ignite by answering several "Is Ignite a...?" questions:

Is Ignite a persistent or pure in-memory storage?

Both. Native persistence in Ignite can be turned on and off. This allows Ignite to store datasets bigger than can fit in the available memory. Essentially, the smaller operational data sets can be stored in-memory only, and larger datasets that do not fit in-memory can be stored on-n disk, using memory as a caching layer for better performance.

Is Ignite an in-memory database (IMDB)?

Yes. Even though Ignite durable memory works well in-memory and on-disk, the disk persistence can be disabled and Ignite can act as a pure distributed in-memory database with support for SQL and distributed joins.

Is Ignite an in-memory data grid (IMDG)?

Yes. Ignite is a full-featured data grid that can be used either in either pure in-memory mode or with Ignite native persistence. It can also automatically integrate with any third-party databases, including any RDBMS or NoSQL stores.

Is Ignite a distributed database?

Yes. Data in Ignite is either partitioned or replicated across a cluster of multiple nodes. This provides scalability and adds resiliency to the system. Ignite automatically controls how data is partitioned; however, users can plug in their own distribution (affinity) functions and collocate various pieces of data together for efficiency.

Is Ignite an SQL database?

Not fully. Although Ignite aims to behave like any other relational SQL database, there are differences in how Ignite handles constraints and indexes. Ignite supports primary and secondary indexes; however, the uniqueness can only be enforced for the primary indexes. Ignite also does not support foreign key constraints.

Essentially, Ignite purposely does not support any constraints that would entail a cluster broadcast message for each update and significantly hurt performance and scalability of the system.

Is Ignite a transactional database?

Not fully. ACID transactions are supported, but only at the key-value API level. Ignite also supports cross-partition transactions, which means that transactions can span keys residing in different partitions on different servers. At the SQL level, Ignite supports atomic, but not yet transactional consistency. Ignite community plans to implement SQL transactions in version 2.4.

Is Ignite a key-value store?

Yes. Ignite provides a feature-rich key-value API that is JCache (JSR-107) compliant and supports Java, C++, and.NET.

You can find out more about Ignite by visiting the freshly redesigned Ignite website.




1 2 3 4 5 6 7 8 9 10 다음

Google Analytics