Question: I have a table 

```
CREATE TABLE PRODUCT (
PRODUCT_ID BIGINT NOT NULL AUTO_INCREMENT,
PRICE DOUBLE NOT NULL,
NAME VARCHAR(50) NOT NULL,
PRIMARY KEY(PRODUCT_ID)
);

```

I need a constraint which ensures the price is always greater then 0 if the NAME is NOT 'TestProduct'

I have been searching and not been able to find anything suitable 

Any idea?

Answer: 
I was able to reproduce and found the problem.

Turns out that the setting `org.eclipse.jdt.core.compiler.compliance` needs to be set to the target version in order for it
to be able to recognize `java.lang.Enum`.

This setting is only set by plexus-compiler-eclipse when both `targetVersion` AND `optimize` is set. [1]

Modify your pom like this and it should work:

```
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version> <!-- or 3.0 -->
    <configuration>
        <compilerId>eclipse</compilerId>
        <source>1.6</source>
        <target>1.6</target>
        <optimize>true</optimize>   <!-- add this line! -->

```

I'm not sure why it was decided in plexus-compiler-eclipse that optimization would affect the compliance level, so this is in fact a workaround.

Also, this code is enough to trigger the issue:

```
class Foo {
    static enum MyEnum { A }

    void foo() {
        switch ( MyEnum.A ) { case A: }
    }
}

```

[1] <https://github.com/sonatype/plexus-compiler/blob/master/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java#L156>
Don't use eclipse compiler in Maven build. If you omit the line 

```
    <compilerId>eclipse</compilerId>

```

everything works fine, which shows that this is a problem specific to the eclipse compiler.