Search code examples
oracle-databaseh2synonym

Oracle synonym alternatives in H2?


I want to use H2 for unit test and want to copy the structure (as close as possible) from a oracle database.

I found some synonyms created in the oracle database

CREATE OR REPLACE EDITIONABLE SYNONYM "SYSTEM1"."SYS2_USER_VIEW" FOR "SYSTEM2"."USER_VIEW";

AFAIK, H2 does not have any support on creating synonyms. Any alternatives or workarounds to achieve the similar?

Edit: I am using H2 version 1.4.196 according to my maven settings


Solution

  • H2 has an undocumented

    CREATE [ OR REPLACE ] SYNONYM [ IF NOT EXISTS ] synonymName FOR targetTableOrView
    

    command.

    But H2 does not support additional clauses from recent versions of Oracle database, such as EDITIONABLE.