Questions tagged [notnull]

This tag refers to an object or type that is not null (none).

Use this tag for questions related to not-null types or objects (i.e. detecting them, handling them, etc.).

295 questions
4
votes
2 answers

Select distinct multiple field without NULL

I have a table with Value ID and Value -------------- | id | value | -------------- | 1 | NULL | -------------- | 1 | A | -------------- | 2 | NULL | -------------- | 2 | NULL | -------------- | 3 | B | -------------- | 3 | B…
Saanch
  • 1,814
  • 1
  • 24
  • 38
4
votes
4 answers

Kotlin: property declaration in hibernate model

We have plenty of java applications and are trying to implement our first one in Kotlin. The Question is: what is the best way to initialize the properties of a simple hibernate model? Let's take the following example in Java: @Entity @Table(name =…
Materno
  • 343
  • 8
  • 20
4
votes
0 answers

@NotNull validation on constructor arguments doesnt work

I have class with final fields. When I validate my fields on the constructor - there is a NullPointerException. I use javax.validation.constraints.NotNull. It is occurs only when I validate fields in the constructor. When I do it earlier - it`s…
michf
  • 209
  • 6
  • 17
4
votes
4 answers

Select all records whose specific field is not NULL

I have a MySQL table named stars and one of its fields is id_num with default value NULL. I want to select all the records where id_num is not NULL through a PreparedStatement in java. Right now I am trying this : private final String idStarsSQL =…
Marievi
  • 4,951
  • 1
  • 16
  • 33
4
votes
2 answers

Spring - validation of Integer attribute

I have entity: public class User{ @NotNull private Integer age; } In Restcontroller: @RestController public UserController { ..... } I have BindingResult, but field age Spring doesn't validate. Can you tell me why? Thanks for your…
Ondra Pala
  • 59
  • 1
  • 1
  • 2
4
votes
4 answers

JetBrains' @NotNull works only when project built from IDEA

I wrote a simple project to learn how to work with annotation validation. For that puspose I added maven dependency (also I tried javax.validation, that does not work for me): org.jetbrains
Grofight
  • 51
  • 1
  • 5
4
votes
1 answer

MYSQL where not null for at least one column

There is a cross join table needs to capture rows with at least one not null value for specific columns: where books.id is not null or typings.id is not null or translates.id is not null is there any function or method to prevent duplicate not…
alex
  • 7,551
  • 13
  • 48
  • 80
4
votes
3 answers

MySQL : IS NOT NULL check on custom generated column(alias)

The stored procedure is working fine till now , but I want records only when dist_calculated IS NOT NULL. When I use that condition in where clause , it shows error #1054 - Unknown column 'dist_calculated' in 'where clause'. Witout where clause it…
Pratik Joshi
  • 11,485
  • 7
  • 41
  • 73
4
votes
2 answers

Why not @NotNull anotation remove the warning?

I have wrote a class that implements the comparable interface. I used @NotNull annotation to suppress the waring in the method parameter. But it still shows a warning.The IDE automatically import this package com.sun.istack.internal.NotNull for the…
seal
  • 1,122
  • 5
  • 19
  • 37
4
votes
1 answer

How to use coalesce, or a variation, to pull more than 1 value?

This is a question about COALESCE in PostgreSQL. In a current view I am using COALESCE to grab the first NOT NULL value in a list: COALESCE(vw_header_to_node_13.subsetname, vw_header_to_node_12.subsetname,…
user3329160
  • 165
  • 2
  • 13
4
votes
1 answer

Django ForeignKey null=True fails to drop not null from column

The problem: Here's my class with two ForeignKeys (dept and salary_range). Note null=True: class UserProfile(models.Model): user = models.OneToOneField(User, related_name='user_profile') avatar = models.CharField(max_length=300,…
4
votes
0 answers

Hibernate Validator - @Column(nullable=false) - How to validate persistence annotations?

I am using Hibernate validator for entity validation in my web-app. Hibernate tools generates the entity objects from the database schema with @Column annotation, containing 'nullable = false'. ... @Column(name = "LANG_IDENTIFIER", nullable = false,…
Dimitri Dewaele
  • 10,311
  • 21
  • 80
  • 127
4
votes
2 answers

Mysql does not error on insert or update to null value on not null field

I have a table CREATE TABLE `devicelist` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `ip` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, `serial` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `networkname` varchar(200) COLLATE…
KoSMoS
  • 534
  • 2
  • 5
  • 19
4
votes
1 answer

How to have a fixed size not null varchar with OrmLite?

When declaring a String property in a Poco class, OrmLite will generate a varchar(8000) NULL column for it in the database. for e.g. I have the following class and the generated table for it: I am wondering how can I specify the length for the…
Moslem Ben Dhaou
  • 6,897
  • 8
  • 62
  • 93
4
votes
2 answers

Hibernate Many-to-One mapping with not null constraint

I have a many-to-one mapping and not null constraint on the column. i am getting the exception column is Null while saving. Can anybody please suggest how do i use cascade and inverse in this scenario?
user1448876
  • 49
  • 1
  • 2