A virtual enterprise is an ad hoc coalition of independent business entities who collaborate on the manufacturing of complex products in a networked environment. This collaboration is enabled by the concept of a transaction, a mechanism with which members acquire necessary components from other members. An external procurement request submitted to the enterprise launches a tree-structured series of transactions among its members similar to supply chains. Each such transaction is associated with a purchase price, but also with a risk of failure. That members have the option to procure components from different co-members, each charging its individual price and posing its specific risk, raises challenging optimization problems related to the fulfillment of business objectives. This paper defines a transaction model for virtual enterprises, with formal concepts such as price, risk, and business objectives. The Decision Guidance Query Language DGQL is presented, a language for modeling and solving optimization problems in a database setting, and shows how DGQL can provide intuitive and efficient solutions to the optimization problems raised in the model. The model, the optimization programs, and the experimentation promote strong collaboration and common objectives among its members, and one in which collaboration is limited, with members retaining much of their autonomy and individual objectives.