userfactory.java

来自「OR Mapping工具」· Java 代码 · 共 36 行

JAVA
36
字号
package org.ephman.examples.user;import java.sql.*;import org.ephman.abra.database.*;import org.ephman.abra.utils.*;import org.ephman.examples.user.generated.*;public class UserFactory extends AbstractUserFactory {		private static UserFactory theInstance;	public static synchronized UserFactory getInstance () {		if (theInstance == null)			theInstance = new UserFactory ();		return theInstance;	}	public User getByUserId (DatabaseSession dbSess, String userId) throws SQLException {		return (User)super.getObject (dbSess, super.userId, userId);	}	protected void preStorage (DatabaseSession dbSess, Identified item) throws SQLException {		User user = (User)item;		if (user.getCompany () != null) {			CompanyFactory.getInstance().store (dbSess, user.getCompany ());		}	}		protected void deepRetrieval (DatabaseSession dbSess, Identified item) throws SQLException {		User user = (User)item;		user.setCompany(CompanyFactory.getInstance().getByOid (dbSess, user.getCompanyOid()));	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?