Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在调用SqlSession.openSession(Connection)MyBatis。连接是一个 MySQL 数据库,并且没有在 URL 中指定模式(例如 jdbc:mysql://localhost)。我想在 MyBatis 中设置一个“默认模式”,用于执行映射查询,但我不知道如何。有人知道吗?
SqlSession.openSession(Connection)
如果您的映射查询是使用 MyBatis Generator 生成的,则在生成之前您可以设置模式并将其名称添加到查询中。如果不写模式名称,MyBatis 无法设置默认模式。