Class MySQLAdapter

java.lang.Object
org.apache.cayenne.dba.JdbcAdapter
org.apache.cayenne.dba.mysql.MySQLAdapter
All Implemented Interfaces:
DbAdapter

public class MySQLAdapter
extends JdbcAdapter
DbAdapter implementation for MySQL RDBMS.

Foreign Key Constraint Handling

Foreign key constraints are supported by InnoDB engine and NOT supported by MyISAM engine. This adapter by default assumes MyISAM, so supportsFkConstraints will be false. Users can manually change this by calling setSupportsFkConstraints(true) or better by using an AutoAdapter, i.e. not entering the adapter name at all for the DataNode, letting Cayenne guess it in runtime. In the later case Cayenne will check the table_type MySQL variable to detect whether InnoDB is the default, and configure the adapter accordingly.

Sample Connection Settings

  • Adapter name: org.apache.cayenne.dba.mysql.MySQLAdapter
  • DB URL: jdbc:mysql://serverhostname/dbname
  • Driver Class: com.mysql.jdbc.Driver