Use of empty strings instead of null - a good practice?
问题 Consider for example in the database: CREATE TABLE users ( id INTEGER IDENTITY PRIMARY KEY, last_name VARCHAR (50) DEFAULT '' NOT NULL, first_name VARCHAR (50) DEFAULT '' NOT NULL, email VARCHAR(50) DEFAULT '' NOT NULL) And consider a program that interacts with this database using Hibernate as ORM. In my opinion this would mean: avoiding NullPointerExceptions avoiding the need to check for null values Is this good practice? Please give examples of the pros and cons. 回答1: As PeterMmm writes,