Nikolay Izhikov created IGNITE-8516: ---------------------------------------
Summary: Not null constraint doesn't checked Key: IGNITE-8516 URL: https://issues.apache.org/jira/browse/IGNITE-8516 Project: Ignite Issue Type: Bug Components: sql Affects Versions: 2.4 Reporter: Nikolay Izhikov Fix For: 2.6 User are able to insert null into the not null column through cache-api. Reproducer: {code:java} package org.apache.ignite.internal.processors.sql; public class IgniteNotNullBug extends GridCommonAbstractTest { @Override protected void beforeTestsStarted() throws Exception { startGrid(0); Set<String> nn = new HashSet<>(); nn.add("address"); jcache(grid(0), cacheConfiguration(new QueryEntity(Organization.class.getName(), Address.class.getName()) .addQueryField("address", "java.lang.String", "address") .setNotNullFields(nn)), "ORG_ADDRESS"); } public void testPutNullField() throws Exception { Map<Organization, Address> entries = new HashMap<>(); entries.put(new Organization("1"), new Address(null)); //entries.put(new Organization("2"), new Address("Some address")); IgniteCache<Organization, Address> cache = jcache(0, "ORG_ADDRESS"); cache.putAll(entries); System.out.println("cache.getConfiguration(CacheConfiguration) = " + cache.getConfiguration(CacheConfiguration.class).getQueryEntities()); List<?> objects = execSql("SELECT address FROM ORG_ADDRESS.ADDRESS"); assert ((List)objects.get(0)).get(0) == null; } protected CacheConfiguration cacheConfiguration(QueryEntity qryEntity) { CacheConfiguration<?, ?> cache = defaultCacheConfiguration(); cache.setCacheMode(CacheMode.PARTITIONED); cache.setAtomicityMode(CacheAtomicityMode.ATOMIC); cache.setBackups(1); cache.setWriteSynchronizationMode(FULL_SYNC); cache.setQueryEntities(Collections.singletonList(qryEntity)); return cache; } private List<?> execSql(String sql, Object... args) { SqlFieldsQuery qry = new SqlFieldsQuery(sql) .setArgs(args); return grid(0).context().query().querySqlFields(qry, true).getAll(); } private static class Organization implements Serializable { private final String name; private Organization(String name) { this.name = name; } } private static class Address implements Serializable { private final String address; private Address(String address) { this.address = address; } } } {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)