Example usage for org.springframework.boot.jdbc DatabaseDriver fromProductName

List of usage examples for org.springframework.boot.jdbc DatabaseDriver fromProductName

Introduction

In this page you can find the example usage for org.springframework.boot.jdbc DatabaseDriver fromProductName.

Prototype

public static DatabaseDriver fromProductName(String productName) 

Source Link

Document

Find a DatabaseDriver for the given product name.

Usage

From source file:org.jboss.forge.addon.springboot.commands.jpa.SpringBootJPASetupWizard.java

@Override
public void validate(UIValidationContext validator) {
    final DatabaseType database = dbType.getValue();
    final DatabaseDriver driver = DatabaseDriver.fromProductName(database.name());
    if (driver.equals(DatabaseDriver.UNKNOWN)) {
        // Spring Boot doesn't know about this DB
        validator.addValidationError(dbType, "Spring Boot doesn't know about DB '" + dbType.getName() + "'");
    }//from w ww. ja  va 2 s. c o m

    if (isNotEmbeddedDB(database) && !databaseURL.hasValue() && !dataSourceName.hasValue()) {
        validator.addValidationError(dataSourceName, "Either DataSource name or database URL is required");
        validator.addValidationError(databaseURL, "Either DataSource name or database URL is required");
    }
}